build(precommit): add new hooks

This commit is contained in:
Nathaniel Landau
2022-10-23 11:49:22 -04:00
parent 54cb31ec71
commit 4f35ba24ae
5 changed files with 352 additions and 300 deletions

View File

@@ -1,68 +1,76 @@
---
repos:
- repo: https://github.com/commitizen-tools/commitizen
rev: v2.35.0
hooks:
- id: "commitizen"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-json
exclude: ^files/certs
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: check-yaml
- id: detect-private-key
- id: mixed-line-ending
- id: trailing-whitespace
types: [python]
args: [--markdown-linebreak-ext=md]
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.28.0
hooks:
- id: yamllint
exclude: vault\.yml|\.pre-commit-config.yaml
files: \.(yaml|yml)$
types: [file, yaml]
entry: yamllint --strict --config-file .yamllint.yml
- repo: local
hooks:
- id: ansible-lint
name: running ansible-lint
language: system
exclude: |
(?x)^(
(inventory|vault|variables|default_variables)\.ya?ml|
\..*\.ya?ml|
galaxy-roles/.*\.ya?ml|
templates/.*\.ya?ml|
files/.*\.ya?ml
)$
files: \.ya?ml$
entry: ansible-lint --force-color --parseable --config-file .ansible-lint.yml
- id: lint-shellscript-templates
name: lint shellscript templates
language: system
files: \.sh\.j2$
entry: shellcheck -x --exclude=1009,1054,1056,1072,1073,1083,2001,2148
- id: lint-shellscripts
name: lint shellscripts
language: system
files: \.sh$
entry: shellcheck -x --exclude=2001,2148
- id: run-shellscripts-bats-tests
name: run bats unit tests
language: system
files: \.bats$
entry: bats -t
- repo: "https://github.com/commitizen-tools/commitizen"
rev: v2.35.0
hooks:
- id: "commitizen"
- repo: "https://github.com/pre-commit/pre-commit-hooks"
rev: v4.3.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-json
exclude: ^files/certs
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: check-yaml
- id: detect-private-key
- id: mixed-line-ending
- id: trailing-whitespace
types: [python]
args: [--markdown-linebreak-ext=md]
- repo: "https://github.com/adrienverge/yamllint.git"
rev: v1.28.0
hooks:
- id: yamllint
files: \.(yaml|yml)$
exclude: |
(?x)^(
\.cz|
vault
)\.(yaml|yml)$
entry: yamllint --strict --config-file .yamllint.yml
- repo: local
hooks:
- id: ansible-lint
name: running ansible-lint
language: system
files: \.(yaml|yml)$
pass_filenames: false
entry: ansible-lint --force-color --config-file .ansible-lint.yml
- id: "lint-shellscript-templates"
name: lint shellscript templates
language: system
files: \.sh\.j2$
entry: shellcheck -x --exclude=1009,1054,1056,1072,1073,1083,2001,2148
- id: "lint-shellscripts"
name: lint shellscripts
language: system
files: \.sh$
entry: shellcheck -x --exclude=2001,2148
- id: "run-shellscripts-bats-tests"
name: run bats unit tests
language: system
files: \.bats$
entry: bats -t
- id: "ansible-encryption-check"
name: Ansible Encryption Check
language: system
entry: scripts/ansible-vault-precommit.sh
files: vault\.ya?ml$