TT#160856 add pre-commit

* format yaml files and lint them afterwards
* python rules
* shellcheck

Change-Id: I8a7ca8a81001410e7f026156f94ece1df6c18892
mr10.4
ngcp-config 3 years ago
parent a404461b2a
commit 04a66a2685

1
.gitignore vendored

@ -7,6 +7,7 @@ __pycache__/
.*.sw?
.sw?
.vscode
.vstags
\#*\#
DEADJOE

@ -0,0 +1,38 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.0.11 # or specific tag
hooks:
- id: yamlfmt
args: [--mapping, '2', --sequence, '4', --offset, '2', --width, '150']
exclude: |
(?x)^(.yamllint)$
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.26.3
hooks:
- id: yamllint
args: [--format, parsable, --strict]
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.6.0
hooks:
- id: reorder-python-imports
args: [--py37-plus]
- repo: https://github.com/psf/black
rev: 21.8b0
hooks:
- id: black
- repo: https://gitlab.com/PyCQA/flake8
rev: 3.9.2
hooks:
- id: flake8
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 2.1.5
hooks:
- id: shellcheck

@ -0,0 +1,9 @@
---
extends: default
rules:
line-length:
max: 150
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: false
truthy:
allowed-values: ['yes', 'no', 'true', 'false']
Loading…
Cancel
Save