Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pre-commit for CI style checks. #3062

Merged
merged 11 commits into from
Dec 15, 2022
34 changes: 28 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,50 @@
# To run: `pre-commit run --all-files`
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: debug-statements
- id: mixed-line-ending
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 22.10.0
hooks:
- id: black
language_version: python3
exclude: versioneer.py
args: [--target-version=py38]
files: ^python/
- repo: https://github.com/PyCQA/flake8
rev: 3.8.4
rev: 6.0.0
hooks:
- id: flake8
args: [--config=python/.flake8]
files: ^python/
args: ["--config=setup.cfg"]
files: python/.*$
types: [file]
types_or: [python] # TODO: Enable [python, cython]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will enable flake8 on Cython files in a follow-up PR. Commit 2e4f34f is what I'll put in that PR.

additional_dependencies: ["flake8-force"]
- repo: https://github.com/asottile/yesqa
rev: v1.3.0
hooks:
- id: yesqa
additional_dependencies:
- flake8==3.8.4
- flake8==6.0.0
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v11.1.0
hooks:
- id: clang-format
exclude: |
(?x)^(
cpp/libcugraph_etl|
cpp/tests/c_api/.*
)
Comment on lines +39 to +43
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These exclusions are needed because run-clang-format.py was not kept in sync with the repo's contents. Using pre-commit solves this problem. I don't want a large diff in this PR so I will enable clang-format on those files in a follow-up PR. Commit 9825b90 is what I'll put in that PR.

types_or: [c, c++, cuda]
args: ["-fallback-style=none", "-style=file", "-i"]
- repo: local
hooks:
- id: copyright-check
name: copyright-check
entry: python ./ci/checks/copyright.py --git-modified-only --update-current-year
language: python
pass_filenames: false
additional_dependencies: [gitpython]
Loading