Skip to content
Snippets Groups Projects
Commit 9ab7db36 authored by Robert Rosca's avatar Robert Rosca
Browse files

Merge branch 'feat/pre-commit-checks' into 'master'

Feat/pre commit checks

- Added pre-commit hooks which:
  - isort on `.py` and `.ipynb`
  - flake8 on `.py` and `.ipynb`
  - nbstripout
  - rstcheck
  - check-added-large-files
  - check-ast
  - check-json
  - check-yaml
  - check-toml
  - end-of-file-fixer
  - trailing-whitespace
  - check-docstring-first
  - check-merge-conflict
  - mixed-line-ending
- Hooks run as part of the `check` stage in the CI
- Fixed some of the issues:
  - EoF
  - Trailing whitespace
  - isort (but only for .py)

I included a lot of other changes and fixes in the original MR (https://git.xfel.eu/gitlab/detectors/pycalibration/merge_requests/411) before figuring out how to get the checks to run only on changed files, which meant that the MR implementing pre-commit checks also refactored a decent chunk of code. It would be better to do that refactoring in separate MRs so I've closed the original one and opened this to replace it.

@ahmedk @danilevc @hammerd feel free to review when you have time :smile:

TODO:

- [x] Add pre-commit to requirements.txt
- [x] ~~Don't mutate the code during pre-commit checks~~ - changed my mind about this a few times, left it to mutate the code as that is only done on staged files, so any mutations can be reverted by undoing changes anyway. Added an explanation on this to the readme instead.
- [x] Add info to the readme and to the wiki
- [x] Add explanation of what each of the checks is for in more detail
- [x] Add scripts to execute w/ diff-only (same as the CI pipeline)

See merge request detectors/pycalibration!417
parents 233b8f7e e49dcbcf
1 merge request!417Feat/pre commit checks
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment