Skip to content

Commit

Permalink
Merge pull request #78801 from moxian/tidy-upstream
Browse files Browse the repository at this point in the history
Make clang-tidy feedback on GitHub much more responsive
  • Loading branch information
GuardianDll authored Jan 8, 2025
2 parents 6d2010d + 6fc18f9 commit d6a710d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ jobs:
matrix:
# To make the run finish in the run time limit, we split it up into two
# parts: the src directory and everything else
subset: [ 'src', 'other' ]
subset: [
'directly-changed',
'indirectly-changed-src',
'indirectly-changed-other'
]

runs-on: ubuntu-22.04
env:
Expand Down Expand Up @@ -90,7 +94,7 @@ jobs:
for (const path of files) {
console.log(path);
}
fs.writeFileSync("files_changed", files.join('\n'));
fs.writeFileSync("files_changed", files.join('\n') + '\n');
- uses: ammaraskar/gcc-problem-matcher@master
- name: run clang-tidy
if: ${{ needs.skip-duplicates.outputs.should_skip != 'true' && github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
Expand Down
2 changes: 2 additions & 0 deletions build-scripts/clang-tidy-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ plugin=build/tools/clang-tidy-plugin/libCataAnalyzerPlugin.so

if [ -f "$plugin" ]
then
set -x
LD_PRELOAD=$plugin "$CATA_CLANG_TIDY" --enable-check-profile --store-check-profile=clang-tidy-trace "$@"
else
set -x
"$CATA_CLANG_TIDY" "$@"
fi
13 changes: 9 additions & 4 deletions build-scripts/clang-tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ cmake \

if [ "$CATA_CLANG_TIDY" = "plugin" ]
then
echo "Compiling clang-tidy plugin"
make -j$num_jobs CataAnalyzerPlugin
export PATH=$PWD/tools/clang-tidy-plugin/clang-tidy-plugin-support/bin:$PATH
if ! which FileCheck
Expand Down Expand Up @@ -90,6 +91,7 @@ then
tidyable_cpp_files=$all_cpp_files
else
make \
--silent \
-j $num_jobs \
${COMPILER:+COMPILER=$COMPILER} \
TILES=${TILES:-0} \
Expand Down Expand Up @@ -122,11 +124,14 @@ printf "Subset to analyze: '%s'\n" "$CATA_CLANG_TIDY_SUBSET"
# formats are matched. Exit code 1 from grep (meaning no match) is ignored in
# case one subset contains no file to analyze.
case "$CATA_CLANG_TIDY_SUBSET" in
( src )
tidyable_cpp_files=$(printf '%s\n' "$tidyable_cpp_files" | grep -E '(^|/)src/' || [[ $? == 1 ]])
( directly-changed )
tidyable_cpp_files=$(printf '%s\n' "$tidyable_cpp_files" | grep -f ./files_changed || [[ $? == 1 ]])
;;
( other )
tidyable_cpp_files=$(printf '%s\n' "$tidyable_cpp_files" | grep -Ev '(^|/)src/' || [[ $? == 1 ]])
( indirectly-changed-src )
tidyable_cpp_files=$(printf '%s\n' "$tidyable_cpp_files" | grep -E '(^|/)src/' | grep -vf ./files_changed || [[ $? == 1 ]])
;;
( indirectly-changed-other )
tidyable_cpp_files=$(printf '%s\n' "$tidyable_cpp_files" | grep -Ev '(^|/)src/' | grep -vf ./files_changed || [[ $? == 1 ]])
;;
esac

Expand Down

0 comments on commit d6a710d

Please sign in to comment.