Skip to content

Commit

Permalink
Add clang-tidy make target
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelroquetto committed Sep 20, 2024
1 parent 2d7c95c commit 5c4f37f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/clang-tidy-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,5 @@ jobs:
- name: Check Clang Tidy
run: |
cd bpf
clang-tidy-20 *.c *.h | tee clang-tidy-output.txt
if [ $? -ne 0 ] || grep -q "warning:" clang-tidy-output.txt; then
echo "clang-tidy found warnings or errors."
exit 1
fi
CLANG_TIDY=clang-tidy-20 make clang-tidy
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ DRONE ?= drone
CLANG ?= clang
CFLAGS := -O2 -g -Wall -Werror $(CFLAGS)

CLANG_TIDY ?= clang-tidy

# regular expressions for excluded file patterns
EXCLUDE_COVERAGE_FILES="(_bpfel.go)|(/pingserver/)|(/grafana/beyla/test/)|(integration/components)|(/grafana/beyla/docs/)|(/grafana/beyla/configs/)|(/grafana/beyla/examples/)"

Expand Down Expand Up @@ -355,3 +357,7 @@ clean-testoutput:
.PHONY: check-ebpf-integrity
check-ebpf-integrity: docker-generate
git diff --name-status --exit-code || (echo "Run make docker-generate locally and commit the code changes" && false)

.PHONY: clang-tidy
clang-tidy:
cd bpf && $(CLANG_TIDY) *.c *.h
2 changes: 1 addition & 1 deletion bpf/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Checks:
- '-readability-function-cognitive-complexity'
- '-readability-magic-numbers'

WarningsAsErrors: ''
WarningsAsErrors: '*'
HeaderFilterRegex: ''
FormatStyle: none
ExtraArgs: ['--target=bpf', '-Iheaders', '-D__TARGET_ARCH_x86', '-DBPF_DEBUG', '-DBPF_TRACEPARENT']
Expand Down

0 comments on commit 5c4f37f

Please sign in to comment.