Skip to content

Commit f499dc7

Browse files
authored
Retrigger all files check if .clang-tidy file is modified (#600)
1 parent dd7f52a commit f499dc7

File tree

5 files changed

+33
-7
lines changed

5 files changed

+33
-7
lines changed

.github/actions/clang-tidy-native/action.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ inputs:
66
required: false
77
default: 'build'
88
exclude:
9-
description: 'Directories to exclude from analysis'
9+
description: 'Directories to exclude from analysis (space-separated)'
1010
required: false
1111
default: '3rdparty'
1212
clang_tidy_version:
@@ -31,9 +31,31 @@ runs:
3131
run: |
3232
git config --global --add safe.directory $GITHUB_WORKSPACE
3333
git fetch origin ${{ github.event.pull_request.base.ref }}
34-
CHANGED_FILES=$(git diff --name-only \
34+
35+
# Check if .clang-tidy files were changed
36+
CLANG_TIDY_CHANGED=$(git diff --name-only \
3537
origin/${{ github.event.pull_request.base.ref }}...HEAD \
36-
-- '*.cpp' '*.hpp' '*.c' '*.h' | grep -v '^${{ inputs.exclude }}/' || true)
38+
-- '**/.clang-tidy' || true)
39+
40+
if [ -n "$CLANG_TIDY_CHANGED" ]; then
41+
echo "::notice::.clang-tidy configuration changed, analyzing all source files"
42+
# Find all source files in the repository (excluding specified directories)
43+
CHANGED_FILES=$(find . -name "*.cpp" -o -name "*.hpp" -o -name "*.c" -o -name "*.h")
44+
# Filter out excluded directories
45+
for exclude_dir in ${{ inputs.exclude }}; do
46+
CHANGED_FILES=$(echo "$CHANGED_FILES" | grep -v "^./${exclude_dir}/" || true)
47+
done
48+
else
49+
# Only analyze changed source files
50+
CHANGED_FILES=$(git diff --name-only \
51+
origin/${{ github.event.pull_request.base.ref }}...HEAD \
52+
-- '*.cpp' '*.hpp' '*.c' '*.h')
53+
# Filter out excluded directories
54+
for exclude_dir in ${{ inputs.exclude }}; do
55+
CHANGED_FILES=$(echo "$CHANGED_FILES" | grep -v "^${exclude_dir}/" || true)
56+
done
57+
fi
58+
3759
echo "changed_files<<EOF" >> $GITHUB_OUTPUT
3860
echo "$CHANGED_FILES" >> $GITHUB_OUTPUT
3961
echo "EOF" >> $GITHUB_OUTPUT

.github/workflows/static-analysis-pr.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- '**/*.h'
1010
- '**/CMakeLists.txt'
1111
- '**/*.cmake'
12+
- '**/.clang-tidy'
1213
- '.github/workflows/static-analysis-pr.yml'
1314

1415
concurrency:
@@ -59,7 +60,7 @@ jobs:
5960
uses: ./.github/actions/clang-tidy-native
6061
id: review
6162
with:
62-
exclude: 3rdparty
63+
exclude: "3rdparty build"
6364
clang_tidy_version: "20"
6465
- if: steps.review.outputs.total_comments > 0
6566
run: |
@@ -107,7 +108,7 @@ jobs:
107108
uses: ./.github/actions/clang-tidy-native
108109
id: review
109110
with:
110-
exclude: 3rdparty
111+
exclude: "3rdparty build docs_venv .git .pytest_cache .ruff_cache xml"
111112
clang_tidy_version: "20"
112113
- if: steps.review.outputs.total_comments > 0
113114
run: |

modules/task/tests/.clang-tidy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ Checks: >
1010
1111
CheckOptions:
1212
- key: readability-function-cognitive-complexity.Threshold
13-
value: 50 # Relaxed for tests
13+
value: 100 # Relaxed for tests

modules/util/include/func_test_util.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ class BaseRunFuncTests : public ::testing::TestWithParam<FuncTestParam<InType, O
9191
/// @brief Initializes task instance and runs it through the full pipeline.
9292
void InitializeAndRunTask(const FuncTestParam<InType, OutType, TestType>& test_param) {
9393
task_ = std::get<GTestParamIndex::kTaskGetter>(test_param)(GetTestInputData());
94+
ExecuteTaskPipeline();
95+
}
9496

97+
/// @brief Executes the full task pipeline with validation.
98+
void ExecuteTaskPipeline() {
9599
EXPECT_TRUE(task_->Validation());
96100
EXPECT_TRUE(task_->PreProcessing());
97101
EXPECT_TRUE(task_->Run());

modules/util/include/util.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <cstdint>
55
#include <cstdlib>
66
#include <memory>
7-
#include <source_location>
87
#include <string>
98
#include <typeinfo>
109
#ifdef __GNUG__

0 commit comments

Comments
 (0)