-
Notifications
You must be signed in to change notification settings - Fork 1
/
.pre-commit-config.yaml
101 lines (95 loc) · 3.11 KB
/
.pre-commit-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# https://pre-commit.com/
# More hooks available at:
# https://pre-commit.com/hooks.html
# INSTALL ON MAC:
# brew install pre-commit
# INSTALL ON WINDOWS:
# pip install pre-commit
# INSTALL hooks for this workspace
# pre-commit install
exclude: '^modules/external/.*$'
repos:
# TERRAFORM
# If running tf-docs it must be run first to avoid race condition relating to version constraints.
# BUG: terraform_docs hook conflicts when used more than once.
# Workaround with Python
- repo: local
hooks:
- id: Terraform docs
name: Terraform docs
entry: python examples/terraform-docs.py
language: system
types: [python]
always_run: true
pass_filenames: false
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.74.1
hooks:
# - id: terraform_docs
# args:
# - --args=--lockfile=false
# - --args=--config=.tfdocs-config.yml
- id: terraform_fmt
- id: terraform_validate
# [^/]+: Exclude root module. Validation is done via examples/basic
# see https://github.com/antonbabenko/pre-commit-terraform#terraform_validate
exclude: |
(?x)^(
tests/.*|
[^/]+|
)$
- id: terraform_tflint
# Configure tflint by creating and updating the config file below.
args: ['--args=--config=__GIT_WORKING_DIR__/.tflint.hcl']
- id: terraform_tfsec
files: ^.*.tf$
# Configure tfsec by creating and updating the config file below.
args: ['--args=--config-file=__GIT_WORKING_DIR__/.tfsec-config.yml']
- id: terraform_checkov
# Configure checkov by creating and updating the config file below.
args: ['--args=--config-file __GIT_WORKING_DIR__/.checkov-config.yml']
# Python
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8
# PRECOMMIT - GENERAL
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-added-large-files
args: ['--maxkb=1024']
- id: check-case-conflict
- id: check-json
exclude: tsconfig.json|devcontainer.json
# - id: pretty-format-json
# exclude: tsconfig.json|package-lock.json|package.json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: check-yaml
exclude: cloud-init-ephemeral.yaml|cloud-init.yaml
- id: detect-aws-credentials
args: ['--allow-missing-credentials']
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
args: ['--fix=lf']
- id: no-commit-to-branch
args: ['--branch', 'develop', '--branch', 'main', '--branch', 'master']
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: local
hooks:
- id: no-vanilla-readme
name: Ensure README is updated
entry: "example content; edit to suit your module"
language: pygrep
types: [text]
files: README.md