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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
19 changes: 17 additions & 2 deletions .github/actions/clang-tidy-native/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,24 @@ 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' '**/.clang-tidy' || true)

if [ -n "$CLANG_TIDY_CHANGED" ]; then
echo "Clang-tidy configuration changed, analyzing all files"
# Get all C++ files in the repo (excluding specified directories)
CHANGED_FILES=$(find . -name "*.cpp" -o -name "*.hpp" -o -name "*.c" -o -name "*.h" | \
grep -v "^\./${{ inputs.exclude }}/" | sed 's|^\./||' || true)
else
# Only analyze changed C++ files
CHANGED_FILES=$(git diff --name-only \
origin/${{ github.event.pull_request.base.ref }}...HEAD \
-- '*.cpp' '*.hpp' '*.c' '*.h' | grep -v '^${{ inputs.exclude }}/' || true)
fi

echo "changed_files<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGED_FILES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
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
14 changes: 13 additions & 1 deletion modules/util/include/func_test_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,26 @@ class BaseRunFuncTests : public ::testing::TestWithParam<FuncTestParam<InType, O
void InitializeAndRunTask(const FuncTestParam<InType, OutType, TestType>& test_param) {
task_ = std::get<GTestParamIndex::kTaskGetter>(test_param)(GetTestInputData());

ValidateTask();
ExecuteTaskPipeline();
VerifyOutput();
}

private:
void ValidateTask() {
EXPECT_TRUE(task_->Validation());
}

void ExecuteTaskPipeline() {
EXPECT_TRUE(task_->PreProcessing());
EXPECT_TRUE(task_->Run());
EXPECT_TRUE(task_->PostProcessing());
}

void VerifyOutput() {
EXPECT_TRUE(CheckTestOutputData(task_->GetOutput()));
}

private:
ppc::task::TaskPtr<InType, OutType> task_;
};

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