-
Notifications
You must be signed in to change notification settings - Fork 875
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
Turn on CI for clang-tidy
#10064
Turn on CI for clang-tidy
#10064
Conversation
Codecov Report
@@ Coverage Diff @@
## branch-22.04 #10064 +/- ##
================================================
- Coverage 86.13% 85.97% -0.17%
================================================
Files 139 139
Lines 22438 22435 -3
================================================
- Hits 19328 19288 -40
- Misses 3110 3147 +37
Continue to review full report at Codecov.
|
This PR is adding clang-tidy to cudf and adding the initial checks. Note more checks will be enabled in the future. Relevant PRs: * `rmm`: rapidsai/rmm#857 * `cuml`: rapidsai/cuml#1945 To do list: * [x] Add `.clang-tidy` file * [x] Add python script * [x] Apply `modernize-` changes * [x] Revert `cxxopts` changes * [x] Fixed Python parquet failures * [x] Ignore `cxxopts` file * [x] Ignore the `build/_deps` directories Splitting out the following into a separate PR so we can get the changes merged for 22.02 (#10064): * ~~[ ] Disable `clang-diagnostic-errors/warnings`~~ * ~~[ ] Fix include files being skipped~~ * ~~[ ] Set up CI script~~ * ~~[ ] Clean up python script~~ Authors: - Conor Hoekstra (https://github.com/codereport) Approvers: - Bradley Dice (https://github.com/bdice) - Nghia Truong (https://github.com/ttnghia) - David Wendt (https://github.com/davidwendt) - Mark Harris (https://github.com/harrism) - Vyas Ramasubramani (https://github.com/vyasr) URL: #9860
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.
LGTM, with two minor Python improvements.
cpp/scripts/run-clang-tidy.py
Outdated
@@ -86,7 +85,7 @@ def get_gpu_archs(command): | |||
def get_index(arr, item): | |||
try: | |||
return arr.index(item) | |||
except: | |||
except Exception: |
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.
arr = [1, 2, 3]
arr.index(4) # Raises ValueError
Let's catch a more specific error:
except Exception: | |
except ValueError: |
cpp/scripts/run-clang-tidy.py
Outdated
else: | ||
out = "CMD: " + cmd | ||
out += result.stdout.decode("utf-8").rstrip() | ||
out = ("" if status else "CMD: " + cmd) + result.stdout.decode("utf-8").rstrip() |
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.
Decode/encode bytes
str
uses UTF-8 by default in Python 3.
out = ("" if status else "CMD: " + cmd) + result.stdout.decode("utf-8").rstrip() | |
out = ("" if status else "CMD: " + cmd) + result.stdout.decode().rstrip() |
rerun tests |
1 similar comment
rerun tests |
rerun tests |
This PR has been labeled |
This changeset is large, but it's not very substantial. It's all the automated fixes produced by clang-tidy using our script. The bulk of the changes are either adding `[[nodiscard]]` to many functions or changing const ref args to pass by value and then move in cases where the parameter is only used to set a value. There are also some places where clang-tidy preferred either more or less namespacing of objects depending on the current namespace. The goal is to enable clang-tidy in CI, which we made progress towards in #9860 but stalled in #10064. This PR contains the first set of changes that will required for such a check to pass. I've marked this PR as breaking because some of the functions now marked as `[[nodiscard]]` are public APIs, so if consumers were ignoring the return values they will now see warnings, and if they are compiling with warnings as errors then the builds will break. Contributes to #584 Authors: - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - Bradley Dice (https://github.com/bdice) - Nghia Truong (https://github.com/ttnghia) URL: #15894
This is a follow up to #9860
To do list:
clang-diagnostic-errors/warnings