Skip to content
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

[NFC] Fix clang-tidy in CI probably after 4294bca5e #2220

Merged
merged 1 commit into from
Nov 16, 2023
Merged
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
36 changes: 1 addition & 35 deletions .github/workflows/check-code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,41 +96,7 @@ jobs:
run: |
cat diff-to-inspect.txt | /usr/lib/llvm-${{ env.LLVM_VERSION }}/share/clang/clang-tidy-diff.py \
-p1 -clang-tidy-binary clang-tidy-${{ env.LLVM_VERSION }} -quiet \
-path ${{ github.workspace}}/build > clang-tidy.log 2>/dev/null
# By some reason, clang-tidy log contains tons of extra empty lines,
# that confuse the check below
sed -i '/^$/d' clang-tidy.log
if [ -s clang-tidy.log ]; then
if ! grep -q "No relevant changes found." clang-tidy.log; then
# Emit annotations
while read -r line; do
type="error"
if [[ $line == *"warning:"* ]]; then
type="warning"
elif [[ $line == *"error:"* ]]; then
type="error"
else
continue
fi

absolute_path=$(echo $line | grep -Po "^[\w\d-./]+(?=:)")
relative_path=${absolute_path##"${{ github.workspace }}"}

line_number=$(echo $line | grep -Po "(?<=:)\d+(?=:\d)")

message=$(echo $line | grep -Po "(?<=${type}: ).*$")

# see [workflow-commands] for documentation
echo "::${type} file=${relative_path},line=${line_number}::${message}"
done < clang-tidy.log

echo "clang-tidy found incorrectly written code:"
cat clang-tidy.log
exit 1
else
rm clang-tidy.log # to avoid uploading empty file
fi
fi
-path ${{ github.workspace}}/build

- name: Upload patch with clang-format fixes
uses: actions/upload-artifact@v2
Expand Down