-
Notifications
You must be signed in to change notification settings - Fork 197
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
Run linters using pre-commit #965
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
aeb2979
Run linters using pre-commit
benfred 4f58550
Fix pylibraft import order
benfred 5b252e8
Merge branch 'branch-22.12' into pre-commit
benfred 319e32c
isort again
benfred a65aefd
Code review feedback
benfred 2572ce1
fix cmake format
benfred 6ca41a3
use cudf flake8 config
benfred 3c89559
Merge remote-tracking branch 'origin/branch-22.12' into pre-commit
benfred 16c1632
Re-apply cmake format to upstream changes
benfred daf13b3
Merge remote-tracking branch 'origin/branch-22.12' into pre-commit
benfred 1a6e011
re-apply cmake format to cpp/test/CMakeLists.txt
benfred File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# Copyright (c) 2022, NVIDIA CORPORATION. | ||
|
||
repos: | ||
- repo: https://github.com/PyCQA/isort | ||
cjnolet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
rev: 5.10.1 | ||
hooks: | ||
- id: isort | ||
# Use the config file specific to each subproject so that each | ||
# project can specify its own first/third-party packages. | ||
args: ["--config-root=python/", "--resolve-all-configs"] | ||
files: python/.* | ||
types_or: [python, cython, pyi] | ||
- repo: https://github.com/psf/black | ||
rev: 22.3.0 | ||
hooks: | ||
- id: black | ||
files: python/.* | ||
# Explicitly specify the pyproject.toml at the repo root, not per-project. | ||
args: ["--config", "pyproject.toml"] | ||
exclude: .*_version.py,.*versioneer.py | ||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 5.0.4 | ||
hooks: | ||
- id: flake8 | ||
args: ["--config=setup.cfg"] | ||
files: python/.*$ | ||
types: [file] | ||
types_or: [python, cython] | ||
additional_dependencies: ["flake8-force"] | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: 'v0.971' | ||
hooks: | ||
- id: mypy | ||
additional_dependencies: [types-cachetools] | ||
args: ["--config-file=setup.cfg", | ||
"python/pylibraft/pylibraft", | ||
"python/raft-dask/raft_dask"] | ||
pass_filenames: false | ||
exclude: .*_version.py | ||
- repo: https://github.com/PyCQA/pydocstyle | ||
rev: 6.1.1 | ||
hooks: | ||
- id: pydocstyle | ||
args: ["--config=setup.cfg"] | ||
- repo: https://github.com/pre-commit/mirrors-clang-format | ||
rev: v11.1.0 | ||
hooks: | ||
- id: clang-format | ||
types_or: [c, c++, cuda] | ||
args: ["-fallback-style=none", "-style=file", "-i"] | ||
exclude: cpp/include/raft/thirdparty/.* | ||
- repo: local | ||
hooks: | ||
- id: no-deprecationwarning | ||
name: no-deprecationwarning | ||
description: 'Enforce that DeprecationWarning is not introduced (use FutureWarning instead)' | ||
entry: '(category=|\s)DeprecationWarning[,)]' | ||
language: pygrep | ||
types_or: [python, cython] | ||
- id: cmake-format | ||
name: cmake-format | ||
entry: ./cpp/scripts/run-cmake-format.sh cmake-format | ||
language: python | ||
types: [cmake] | ||
exclude: .*/thirdparty/.* | ||
# Note that pre-commit autoupdate does not update the versions | ||
# of dependencies, so we'll have to update this manually. | ||
additional_dependencies: | ||
- cmakelang==0.6.13 | ||
verbose: true | ||
require_serial: true | ||
- id: cmake-lint | ||
name: cmake-lint | ||
entry: ./cpp/scripts/run-cmake-format.sh cmake-lint | ||
language: python | ||
types: [cmake] | ||
# Note that pre-commit autoupdate does not update the versions | ||
# of dependencies, so we'll have to update this manually. | ||
additional_dependencies: | ||
- cmakelang==0.6.13 | ||
verbose: true | ||
require_serial: true | ||
exclude: .*/thirdparty/.* | ||
- 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] | ||
- id: include-check | ||
name: include-check | ||
entry: python ./cpp/scripts/include_checker.py cpp/bench cpp/include cpp/test | ||
pass_filenames: false | ||
language: python | ||
additional_dependencies: [gitpython] | ||
|
||
default_language_version: | ||
python: python3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll mention it here because I haven't fixed it yet in cuDF and this is a new file: the indentation of this file is ...aggressive. I'd prefer to see something more like 2 or 4 spaces instead of 8 spaces in some places and 2 or 4 in others. Maybe there's a standard YAML formatter that can be run once (no need to enforce the format with tooling, just get it into a normalized state).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually add https://github.com/jumanjihouse/pre-commit-hook-yamlfmt to the pre-commit hooks for this reason.