Closed matthewfeickert closed 3 years ago
Also from here: https://scikit-hep.org/developer/style#pre-commit
If you have a style only change, you can list it in .git-blame-ignore-revs
(often, just using the whitespace ignore to blame is enough). https://www.moxio.com/blog/43/ignoring-bulk-change-commits-with-git-blame
It's not picked up by GitHub, yet, sadly.
Though, for generated files, I'd probably just turn off the end-of-file fixer for those extensions.
Though, for generated files, I'd probably just turn off the end-of-file fixer for those extensions.
Ah, I didn't realize you could use exclude
s in pre-commit
. Thanks @henryiii!
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-json
- id: check-yaml
- id: check-toml
- id: check-xml
- id: debug-statements
- id: end-of-file-fixer
# exclude generated files
exclude: validation/|\.dtd$|\.json$|\.xml$
- id: mixed-line-ending
- id: requirements-txt-fixer
- id: trailing-whitespace
# exclude generated files
exclude: validation/|\.dtd$|\.xml$
works nicely now. :+1:
Description
Given that we're taking advantage of
pre-commit.ci
it is probably also worth considering to use thepre-commit
hooks from https://github.com/pre-commit/pre-commit-hooks ("Some out-of-the-box hooks for pre-commit.").Modifying the version that @henryiii has in his Level Up Your Python section on pre-commit to
v3.4.0
and to usecheck-json
,check-toml
, andcheck-xml
(currently on branchci/add-pre-commit-hooks-hooks
)passes almost everything right out of the box. The one thing it is changing is
end-of-file-fixer
is trying to change the schemas and validation files that were generated with no ending newline@kratsg @lukasheinrich if you like the idea of thes hooks in general should we avoid
end-of-file-fixer
or try to setup ignores? Or should we just let it change things, creating large useless diffs?