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

Use clang-tidy on ebpf code #1180

Merged
merged 22 commits into from
Sep 20, 2024
Merged

Use clang-tidy on ebpf code #1180

merged 22 commits into from
Sep 20, 2024

Conversation

rafaelroquetto
Copy link
Contributor

@rafaelroquetto rafaelroquetto commented Sep 18, 2024

This PR enables the use of clang-tidy to lint the code in the bpf/ directory. In a nutshell:

  • Provide an initial .clang-tidy configuration. Not all checks are enabled at this time. Because it will take time to address the issues that come up when new checks are enabled, these will be done on a staggered fashion;
  • Lint the current source code according to the current .clang-tidy configuration - the source files inside the bpf/ directory have been linted and adjusted to ensure the current checks pass. Files inside the headers/ directory are mostly ignored (specially vmlinux.h as they are both problematic and auto-generated.
  • Enforce the linter rules by providing a workflow for clang-tidy. Because the vanilla clang-tidy package that ships with the runner is out of date (and unable to parse our configuration file), we fetch the latest clang binaries directly from the LLVM apt repositories.

Another PR will follow shortly documenting the usage of clang-format and clang-tidy on the README file.

@rafaelroquetto rafaelroquetto added do-not-merge WIP or something that musn't be merged wip labels Sep 18, 2024
@codecov-commenter
Copy link

codecov-commenter commented Sep 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.19%. Comparing base (cbca5fe) to head (74ec832).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1180      +/-   ##
==========================================
+ Coverage   81.12%   81.19%   +0.06%     
==========================================
  Files         136      136              
  Lines       11497    11497              
==========================================
+ Hits         9327     9335       +8     
+ Misses       1639     1633       -6     
+ Partials      531      529       -2     
Flag Coverage Δ
integration-test 57.02% <ø> (+0.02%) ⬆️
k8s-integration-test 58.93% <ø> (+0.12%) ⬆️
oats-test 35.82% <ø> (-0.07%) ⬇️
unittests 53.33% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rafaelroquetto rafaelroquetto force-pushed the clang-tidy2 branch 3 times, most recently from f564c3c to 108550b Compare September 19, 2024 22:09
@rafaelroquetto rafaelroquetto force-pushed the clang-tidy2 branch 3 times, most recently from ae27abf to 72c58c5 Compare September 20, 2024 03:00
@rafaelroquetto rafaelroquetto changed the title WIP: use clang-tidy linter Use clang-tidy on ebpf code Sep 20, 2024
@rafaelroquetto rafaelroquetto removed do-not-merge WIP or something that musn't be merged wip labels Sep 20, 2024
@rafaelroquetto rafaelroquetto marked this pull request as ready for review September 20, 2024 03:14
Copy link
Contributor

@grcevski grcevski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Nice!

@rafaelroquetto rafaelroquetto merged commit 2d7c95c into main Sep 20, 2024
11 checks passed
@rafaelroquetto rafaelroquetto deleted the clang-tidy2 branch September 20, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants