-
Notifications
You must be signed in to change notification settings - Fork 4
Local checking: pre commit
lachmanfrantisek edited this page Feb 20, 2019
·
7 revisions
- tool for managing git-hooks scripts for automatical analysis
- 💻 github.com/pre-commit/pre-commit, 📜 documentation
- , , no 📦 fedora packages
- support for scripts/tools installable from an external repo (like the one from authors)
- multiple linting tools support this out-of-the-box
- scripts can also edit the files (e.g. black or
trailing-whitespace
from author's pre-commit-hooks repo) - not only
pre-commit
, but also other git-hooks (e.g. pre-push) - Possibility to run manualy (e.g. CI):
$ pre-commit run --all-files
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
Trim Trailing Whitespace.................................................Failed
hookid: trailing-whitespace
Files were modified by this hook. Additional output:
Fixing release-conf.yaml
Fixing CONTRIBUTING.md
$ pre-commit run --all-files
Trim Trailing Whitespace.................................................Passed
- example config:
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0
hooks:
- id: trailing-whitespace
- id: detect-private-key
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
language_version: python3.6