hearding all your linters
the tool, not the git hook
hook
is mainly a linterpip install pre-commit
# .pre-commit-config.yaml
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/ansible/ansible-lint
rev: v4.3.0a0
hooks:
- id: ansible-lint
$ pre-commit run
[INFO] Installing environment for local.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/ansible/ansible-lint.git.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
Mixed line ending........................................................Passed
Check for byte-order marker..............................................Passed
Check that executables have shebangs.....................................Passed
Check for merge conflicts................................................Passed
Check for broken symlinks................................................Passed
Debug Statements (Python)................................................Passed
Flake8...................................................................Passed
Check Yaml...............................................................Passed
yamllint.................................................................Passed
Ansible-lint.............................................................Passed
bashate..................................................................Passed
Are my linters outdated?
# just try to bump all linters
$ pre-commit auto-update
Updating https://github.com/pre-commit/pre-commit-hooks ... updating v2.4.0 -> v3.1.0.
Updating https://github.com/PyCQA/flake8.git ... [INFO] Initializing environment for https://github.com/PyCQA/flake8.git.
updating 3.7.9 -> 3.8.2.
Updating https://github.com/adrienverge/yamllint.git ... updating v1.20.0 -> v1.23.0.
Updating https://github.com/ansible/ansible-lint ... updating v4.2.0 -> v4.3.0a1.
Updating https://github.com/openstack-dev/bashate.git ... updating 0.6.0 -> 2.0.0.
# run on *all* files
$ pre-commit run -a
# if all good, save changes
$ git commit -a
~/.cache/pre-commit
on CI/CD highly recommendedPresentation source is available at sbarnea/slides