PSMDB-1811: add clang-tidy workflow for pull requests (v8.0)#1606
PSMDB-1811: add clang-tidy workflow for pull requests (v8.0)#1606
Conversation
| << "; statusCode: " << code << "; body: `" << body << "`") {} | ||
|
|
||
| // Test function with StringData const ref (should trigger mongo-stringdata-const-ref-check) | ||
| void testStringDataRef(const StringData& testParam) { |
Check failure
Code scanning / clang-tidy
Prefer passing StringData by value.
| << reason << ".") {} | ||
|
|
||
| // Test function with std::optional (should trigger mongo-std-optional-check) | ||
| std::optional<std::string> testStdOptional() { |
Check failure
Code scanning / clang-tidy
Use of std::optional, use boost::optional instead.
|
|
||
| // Test function with std::atomic (should trigger mongo-std-atomic-check) | ||
| void testStdAtomic() { | ||
| std::atomic<int> counter{0}; // Should use boost::atomic instead |
Check failure
Code scanning / clang-tidy
Illegal use of prohibited std::atomic<T>, use AtomicWord<T> or other types from "mongo/platform/atomic_word.h"
|
|
||
| // Test function with std::rand (should trigger mongo-rand-check) | ||
| void testStdRand() { | ||
| int randomValue = std::rand(); // Should use mongo::PseudoRandom instead |
Check failure
Code scanning / clang-tidy
Use of rand or srand, use <random> or PseudoRandom instead.
| }; | ||
|
|
||
| namespace { | ||
| void check_string_data(const StringData& sd) { |
Check failure
Code scanning / clang-tidy
Prefer passing StringData by value.
3c77ed5 to
b3a275e
Compare
Add CI clang-tidy workflow with SARIF reporting and support for skip label. Use artifacts caching to speed up the execution.
b3a275e to
8cff195
Compare
| run: | | ||
| # Need to use clang as the mongo_tidy_checks plugin does not compile with gcc 11.3.0 | ||
| { | ||
| echo 'build --//bazel/config:compiler_type=clang' |
There was a problem hiding this comment.
That is the only change comparing to the master branch. We need to build the clang-tidy plugin with clang when using toolchain v4 because the plugin does not compile with the gcc version from v4.
Add CI clang-tidy workflow with SARIF reporting and support
for skip label. Use artifacts caching to speed up the execution.