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
Merged

Conversation

bdice
Copy link
Contributor

@bdice bdice commented Dec 8, 2022

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.

@@ -1,4 +1,4 @@
# Copyright (c) 2020-2022, NVIDIA CORPORATION.
# Copyright (c) 2019-2022, NVIDIA CORPORATION.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file was updated to better support pre-commit (I copied these changes from cudf). It also supports autofixing now, so if the style checks fail, it will tell you exactly which files need to change and what they should say.

@BradReesWork BradReesWork added this to the 23.02 milestone Dec 8, 2022
@BradReesWork BradReesWork added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Dec 8, 2022
@bdice
Copy link
Contributor Author

bdice commented Dec 9, 2022

I'm going to go ahead and revert the two commits for clang-format and flake8 Cython that make this diff large. I'll make separate PRs for those after the first commit is merged.

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.

Comment on lines +39 to +43
exclude: |
(?x)^(
cpp/libcugraph_etl|
cpp/tests/c_api/.*
)
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.

@bdice bdice marked this pull request as ready for review December 9, 2022 20:14
@bdice bdice requested review from a team as code owners December 9, 2022 20:14
Copy link
Collaborator

@ChuckHastings ChuckHastings left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov-commenter
Copy link

codecov-commenter commented Dec 9, 2022

Codecov Report

Base: 58.86% // Head: 58.95% // Increases project coverage by +0.08% 🎉

Coverage data is based on head (752412d) compared to base (2ae4b61).
Patch coverage: 88.88% of modified lines in pull request are covered.

Additional details and impacted files
@@               Coverage Diff                @@
##           branch-23.02    #3062      +/-   ##
================================================
+ Coverage         58.86%   58.95%   +0.08%     
================================================
  Files               131      131              
  Lines              7848     7857       +9     
================================================
+ Hits               4620     4632      +12     
+ Misses             3228     3225       -3     
Impacted Files Coverage Δ
...ugraph/cugraph/dask/structure/mg_property_graph.py 12.14% <33.33%> (+0.05%) ⬆️
python/cugraph/cugraph/structure/property_graph.py 94.95% <100.00%> (+0.02%) ⬆️
python/cugraph/cugraph/utilities/utils.py 71.71% <100.00%> (+1.34%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@bdice bdice mentioned this pull request Dec 13, 2022
11 tasks
@BradReesWork
Copy link
Member

rerun tests

@BradReesWork
Copy link
Member

@gpucibot merge

@rapids-bot rapids-bot bot merged commit de76e64 into rapidsai:branch-23.02 Dec 15, 2022
rapids-bot bot pushed a commit that referenced this pull request Apr 15, 2024
#3062 added pre-commit hooks for formatting C and C++ code.  However, libcugraph_etl and the C API unit tests are currently excluded from that check.  The intention was to get back around to them and include them in the testing.  However, that slipped through the cracks.

This PR adds the pre-commit hooks for those files as well.

Authors:
  - Chuck Hastings (https://github.com/ChuckHastings)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Seunghwa Kang (https://github.com/seunghwak)
  - Mark Harris (https://github.com/harrism)

URL: #4332
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants