Skip to content

Retrigger all files check if .clang-tidy file is modified #600

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

Merged
merged 1 commit into from
Aug 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions .github/actions/clang-tidy-native/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ inputs:
required: false
default: 'build'
exclude:
description: 'Directories to exclude from analysis'
description: 'Directories to exclude from analysis (space-separated)'
required: false
default: '3rdparty'
clang_tidy_version:
Expand All @@ -31,9 +31,31 @@ runs:
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
git fetch origin ${{ github.event.pull_request.base.ref }}
CHANGED_FILES=$(git diff --name-only \

# Check if .clang-tidy files were changed
CLANG_TIDY_CHANGED=$(git diff --name-only \
origin/${{ github.event.pull_request.base.ref }}...HEAD \
-- '*.cpp' '*.hpp' '*.c' '*.h' | grep -v '^${{ inputs.exclude }}/' || true)
-- '**/.clang-tidy' || true)

if [ -n "$CLANG_TIDY_CHANGED" ]; then
echo "::notice::.clang-tidy configuration changed, analyzing all source files"
# Find all source files in the repository (excluding specified directories)
CHANGED_FILES=$(find . -name "*.cpp" -o -name "*.hpp" -o -name "*.c" -o -name "*.h")
# Filter out excluded directories
for exclude_dir in ${{ inputs.exclude }}; do
CHANGED_FILES=$(echo "$CHANGED_FILES" | grep -v "^./${exclude_dir}/" || true)
done
else
# Only analyze changed source files
CHANGED_FILES=$(git diff --name-only \
origin/${{ github.event.pull_request.base.ref }}...HEAD \
-- '*.cpp' '*.hpp' '*.c' '*.h')
# Filter out excluded directories
for exclude_dir in ${{ inputs.exclude }}; do
CHANGED_FILES=$(echo "$CHANGED_FILES" | grep -v "^${exclude_dir}/" || true)
done
fi

echo "changed_files<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGED_FILES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/static-analysis-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- '**/*.h'
- '**/CMakeLists.txt'
- '**/*.cmake'
- '**/.clang-tidy'
- '.github/workflows/static-analysis-pr.yml'

concurrency:
Expand Down Expand Up @@ -59,7 +60,7 @@ jobs:
uses: ./.github/actions/clang-tidy-native
id: review
with:
exclude: 3rdparty
exclude: "3rdparty build"
clang_tidy_version: "20"
- if: steps.review.outputs.total_comments > 0
run: |
Expand Down Expand Up @@ -107,7 +108,7 @@ jobs:
uses: ./.github/actions/clang-tidy-native
id: review
with:
exclude: 3rdparty
exclude: "3rdparty build docs_venv .git .pytest_cache .ruff_cache xml"
clang_tidy_version: "20"
- if: steps.review.outputs.total_comments > 0
run: |
Expand Down
2 changes: 1 addition & 1 deletion modules/task/tests/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ Checks: >

CheckOptions:
- key: readability-function-cognitive-complexity.Threshold
value: 50 # Relaxed for tests
value: 100 # Relaxed for tests
4 changes: 4 additions & 0 deletions modules/util/include/func_test_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ class BaseRunFuncTests : public ::testing::TestWithParam<FuncTestParam<InType, O
/// @brief Initializes task instance and runs it through the full pipeline.
void InitializeAndRunTask(const FuncTestParam<InType, OutType, TestType>& test_param) {
task_ = std::get<GTestParamIndex::kTaskGetter>(test_param)(GetTestInputData());
ExecuteTaskPipeline();
}

/// @brief Executes the full task pipeline with validation.
void ExecuteTaskPipeline() {
EXPECT_TRUE(task_->Validation());
EXPECT_TRUE(task_->PreProcessing());
EXPECT_TRUE(task_->Run());
Expand Down
1 change: 0 additions & 1 deletion modules/util/include/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <cstdint>
#include <cstdlib>
#include <memory>
#include <source_location>
#include <string>
#include <typeinfo>
#ifdef __GNUG__
Expand Down
Loading