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

Run clang-tidy on headers #3572

Merged
merged 3 commits into from
Jan 5, 2024
Merged

Conversation

jonmeow
Copy link
Contributor

@jonmeow jonmeow commented Jan 5, 2024

This patches bazel_clang_tidy handling of headers. I found an equivalent change at erenon/bazel_clang_tidy#13, but that was already rejected. Per the criticism, this will result in redundant processing of headers.

The project instead uses HeaderFilterRegex: ".*", but that results in two problems:

  1. When running with -k, errors are repeated when a header is included more than once, which is common.
  2. clang-tidy including errors from headers that are included from other modules (e.g., abseil-cpp); filtering correctly is difficult.

Given the trade-offs and options (including forking), I thought patching was preferable so long as it remains narrow.

@github-actions github-actions bot added the explorer Action items related to Carbon explorer code label Jan 5, 2024
@github-actions github-actions bot requested a review from zygoloid January 5, 2024 19:08
@chandlerc chandlerc requested review from chandlerc and removed request for zygoloid January 5, 2024 22:39
Copy link
Contributor

@chandlerc chandlerc left a comment

Choose a reason for hiding this comment

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

LG, and makes sense about the tradeoff.

I'm gonna follow-up on the PR to try and advocate for it to get merged, but we'll see what happens.

@@ -232,6 +232,7 @@ repos:
exclude: |
(?x)^(
MODULE.bazel.lock|
bazel/clang_tidy/.*\.patch|
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe bazel_clang_tidy to avoid any ambiguity with a patch to clang-tidy itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@jonmeow jonmeow enabled auto-merge January 5, 2024 22:49
@jonmeow jonmeow added this pull request to the merge queue Jan 5, 2024
Merged via the queue into carbon-language:trunk with commit a196b98 Jan 5, 2024
7 checks passed
@jonmeow jonmeow deleted the lint-headers branch January 5, 2024 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
explorer Action items related to Carbon explorer code toolchain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants