Skip to content

Commit 8efe448

Browse files
committed
remove ThirdParty code from consideration in clang-tidy
1 parent faaf8bd commit 8efe448

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

.github/actions/run-clang-tidy-pr.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ set -euo pipefail
33

44
ROOT_DIR=$(pwd)
55

6+
is_third_party_file() {
7+
local source_file="$1"
8+
[[ "$source_file" == ThirdParty/* ]]
9+
}
10+
611
append_include_args() {
712
local raw_paths="$1"
813
local split_paths
@@ -24,7 +29,13 @@ FILES_URL="$(jq -r '.pull_request._links.self.href' "$GITHUB_EVENT_PATH")/files"
2429
FILES=$(curl -s -X GET -G "$FILES_URL" | jq -r '.[] | .filename')
2530
echo "====Files Changed in PR===="
2631
echo "$FILES"
27-
filecount=$(echo "$FILES" | grep -c -E '\.(cpp|cc|cxx|c)$' || true)
32+
filecount=$(
33+
while read -r line; do
34+
if [[ "$line" =~ \.(cpp|cc|cxx|c)$ ]] && ! is_third_party_file "$line"; then
35+
echo "$line"
36+
fi
37+
done <<<"$FILES" | grep -c .
38+
)
2839
echo "Total changed: $filecount"
2940
tidyerr=0
3041
if ((filecount > 0 && filecount <= 25)); then
@@ -57,6 +68,10 @@ if ((filecount > 0 && filecount <= 25)); then
5768
fi
5869
while read -r line; do
5970
if echo "$line" | grep -E '\.(cpp|cc|cxx|c)$'; then
71+
if is_third_party_file "$line"; then
72+
echo "skipping ${line}: third-party source"
73+
continue
74+
fi
6075
source_file="${ROOT_DIR}/${line}"
6176
if ! file_in_compile_db "$source_file"; then
6277
echo "skipping ${line}: not present in compilation database"

0 commit comments

Comments
 (0)