-
Notifications
You must be signed in to change notification settings - Fork 937
C++ linting via clang-tidy #1338
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
Conversation
This reverts commit f604191.
docker/code-check.Dockerfile
Outdated
|
|
||
| ADD https://raw.githubusercontent.com/llvm/llvm-project/refs/tags/llvmorg-20.1.7/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py /usr/bin/ | ||
| RUN apk add --no-cache clang-extra-tools linux-headers make python3 git && \ | ||
| chmod +x /usr/bin/clang-tidy-diff.py |
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 see ADD has --chmod option, does it work here?
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.
Had no idea it existed, thanks: a6cb304
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.
So you no longer need to run chmod +x, right?
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.
Right: 32d9bb3
docker/code-check.Dockerfile
Outdated
| # Image for all tasks related to static code analysis in Async-Profiler | ||
| FROM public.ecr.aws/docker/library/amazoncorretto:11-alpine-jdk | ||
|
|
||
| ADD https://raw.githubusercontent.com/llvm/llvm-project/refs/tags/llvmorg-20.1.7/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py /usr/bin/ |
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.
That is better. However, tags are still mutable. Specific commit id would be ideal.
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.
Sure: a6cb304
But on a side not, maybe mutability is not a bad thing for tags? If a tag was overwritten, maybe there was a bug in the release. And a commit wouldn't protect for that.
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.
Mutability is not bad for tags, but my intention is to minimize dependencies outside our control, i.e., to mitigate supply chain threats when a third party can unilaterally change code that is run on our servers.
Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331) Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331)
Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331) Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331)
Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331) Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331)
Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331) Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331)
Description
In this PR I add some lint checks based on clang-tidy. They are mostly aimed at reducing time spent on trivial problems in code review, which can easily be automated.
Checks
The checks I enabled required minimal changes in the code and are not too invasive.
Some examples:
like_this_like_thisFull list of available linter checks: https://clang.llvm.org/extra/clang-tidy/checks/list.html
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.