Skip to content

Commit

Permalink
Use pre-commit for CI style checks. (#3062)
Browse files Browse the repository at this point in the history
This PR adopts `pre-commit` in CI style checks and updates a few of the hooks (flake8, clang-format, and the copyright checker).

This helps with the ongoing transition to GitHub Actions by centralizing style checks.

I also applied a significant set of changes from `clang-format` and `flake8` suggestions in commits cfe6395 and adf0741. To minimize the diff in this PR, we can split those two commits into their own PRs with some small tweaks to the `pre-commit` configuration. Let me know if you'd like me to do this.

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - Chuck Hastings (https://github.com/ChuckHastings)
  - AJ Schmidt (https://github.com/ajschmidt8)
  - Brad Rees (https://github.com/BradReesWork)

URL: #3062
  • Loading branch information
bdice authored Dec 15, 2022
1 parent c151bfb commit de76e64
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 602 deletions.
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]
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/.*
)
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

0 comments on commit de76e64

Please sign in to comment.