Skip to content

fix(clang_tidy): apply the S-CORE baseline in make_clang_tidy_aspect - #52

Draft
antonkri wants to merge 2 commits into
mainfrom
fix/clang-tidy-baseline
Draft

antonkri wants to merge 2 commits into
mainfrom
fix/clang-tidy-baseline

Conversation

@antonkri

@antonkri antonkri commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

make_clang_tidy_aspect passes the S-CORE baseline in configs of lint_clang_tidy_aspect. aspect_rules_lint only puts those files into the sandbox; clang-tidy reads .clang-tidy only from the directories above the linted file. The baseline is in external/score_cpp_policies+/clang_tidy/, so it is never applied.

  • Without local_configs (score_time, this repo's self-test): clang-tidy 22 aborts with Error: no checks enabled. (run).
  • With local_configs (score_baselibs, score_persistency, score_logging): only the local file applies. score_logging's has no Checks.

Changes

  • clang_tidy/defs.bzl: without local_configs, the baseline is passed as global_config (--config-file). With local_configs, they are passed as configs and replace the baseline (--config-file disables clang-tidy's config search, so both cannot be combined).
  • clang_tidy/README.md: setup uses make_clang_tidy_aspect; documents that a local config replaces the baseline.
  • tests/BUILD.bazel, tests.yml: job clang-tidy baseline lints violations/clang_tidy_violation.cpp and expects bugprone-use-after-move (only enabled by the baseline).

Verification

Commit clang-tidy baseline
df3b9b1 (test only) failure: Error: no checks enabled.
c8fb812 (test + fix) success

Consumer check: eclipse-score/reference_integration#502 pins c8fb812 for score_logging, score_time and score_config_management and lints them with make_clang_tidy_aspect.

Impact

  • local_configs set: no change.
  • No local_configs: the baseline applies for the first time, including WarningsAsErrors: clang-analyzer-*.
  • score_logging: drop local_configs (its .clang-tidy only sets HeaderFilterRegex) to get the baseline.

Pre-Review Checklist for the PR Author

  • PR title is short, expressive and meaningful
  • Commits are properly organized
  • Relevant issues are linked in the References section
  • Tests are conducted
  • Unit tests are added

Checklist for the PR Reviewer

  • Commits are properly organized and messages follow S-CORE commit guidelines
  • Unit tests have been written for new behavior
  • Public API is documented
  • PR title describes the changes

Post-review Checklist for the PR Author

  • All open points are addressed and tracked via issues

References

Signed-off-by: Anton Krivoborodov <anton.krivoborodov@bmw.de>
clang-tidy only reads .clang-tidy files in the directories above the linted
file. The baseline lives in score_cpp_policies' external repository, so
passing it in configs never applied it: modules without their own config
ran with clang-tidy's default checks only.

Without local_configs the baseline is now passed as the config file. Local
configs replace the baseline, since --config-file disables clang-tidy's
config search and the two cannot be layered.

Signed-off-by: Anton Krivoborodov <anton.krivoborodov@bmw.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant