Skip to content

Comments

PSMDB-1811: add clang-tidy workflow for pull requests (v8.0)#1606

Merged
plebioda merged 1 commit intov8.0from
PSMDB-1811-github-workflows-clang-tidy-v8.0
Nov 14, 2025
Merged

PSMDB-1811: add clang-tidy workflow for pull requests (v8.0)#1606
plebioda merged 1 commit intov8.0from
PSMDB-1811-github-workflows-clang-tidy-v8.0

Conversation

@plebioda
Copy link

Add CI clang-tidy workflow with SARIF reporting and support
for skip label. Use artifacts caching to speed up the execution.

<< "; 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.

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.

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"

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.

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.

Prefer passing StringData by value.
@plebioda plebioda force-pushed the PSMDB-1811-github-workflows-clang-tidy-v8.0 branch from 3c77ed5 to b3a275e Compare November 12, 2025 10:04
Add CI clang-tidy workflow with SARIF reporting and support
for skip label. Use artifacts caching to speed up the execution.
@plebioda plebioda force-pushed the PSMDB-1811-github-workflows-clang-tidy-v8.0 branch from b3a275e to 8cff195 Compare November 12, 2025 12:30
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'
Copy link
Author

Choose a reason for hiding this comment

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

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.

@plebioda plebioda requested review from igorsol and ktrushin November 13, 2025 08:45
@plebioda plebioda merged commit 6aaece9 into v8.0 Nov 14, 2025
3 checks passed
@plebioda plebioda deleted the PSMDB-1811-github-workflows-clang-tidy-v8.0 branch November 14, 2025 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants