Fix clang-tidy and sanitizer CI config blocking score/time_daemon checks - #216
MaciejSalwa543 wants to merge 8 commits into
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run //:license-checkStatus: Click to expand output |
|
Ran TSan+UBSan manually against
Looks like something I want to fix and add TSan to CI, would you agree? |
|
Closed due to missing clang-tidy config file |
172e39e to
8926082
Compare
pawelrutkaq
left a comment
There was a problem hiding this comment.
We need to tue this return type as auto or at least confirm it
| if [ "$COUNT" -gt "$BASELINE" ]; then | ||
| echo "::error::Clang-tidy violations grew: $COUNT > baseline $BASELINE. Fix new violations before merging." | ||
| echo "::error::Clang-tidy violations in score/time_daemon/ grew: $COUNT > baseline $BASELINE. Fix new violations before merging." | ||
| exit 1 |
There was a problem hiding this comment.
we shall scope TimeDaemon to 0 and leave rest as it was ;)
| } | ||
|
|
||
| JobRunner::Result JobRunner::GetResult() const | ||
| auto JobRunner::GetResult() const -> JobRunner::Result |
There was a problem hiding this comment.
This rule is strange imho and will cause troubles with misra. @lavrovvalera what do you think ?
There was a problem hiding this comment.
I can imagine, it is an advantage, when we can help compiler to deriuve the proper type when it is going about the template, type elicittion and so on.
but here (and everywhere), we can specify the exact return type. why do we need to return auto instead and anyway specify the return value.
for me it doesn't make sense and we need indeed to do somethign with the rule itself
There was a problem hiding this comment.
@MaciejSalwa543 can you indetify which rule is causing this ?
There was a problem hiding this comment.
"modernize-use-trailing-return-type" - included with "modernize*" in .clang-tidy
There was a problem hiding this comment.
Then lets disable this one
| virtual ~BaseMachine() = default; | ||
|
|
||
| inline std::string GetName() const noexcept | ||
| [[nodiscard]] auto GetName() const noexcept -> std::string |
There was a problem hiding this comment.
nodiscrd makse no sense or ?
There was a problem hiding this comment.
https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-nodiscard.html
also "modernize-*"
There was a problem hiding this comment.
Ye but in this API it makse no sense imho
There was a problem hiding this comment.
after looking second times, yeah I think you're right here
| /// \return true - deinitialize success, otherwise false | ||
| /// | ||
| bool Deinitialize() const; | ||
| [[nodiscard]] auto Deinitialize() const -> bool; |
There was a problem hiding this comment.
nodiscrd maybe not needed here
There was a problem hiding this comment.
the same as above
There was a problem hiding this comment.
good catch - always return true
|
|
||
| // NOLINTBEGIN(bugprone-easily-swappable-parameters) — debouncing_clock and max_time_jump_allowed | ||
| // have unrelated, non-convertible types (ReferenceClock vs. chrono::nanoseconds), so swapping the | ||
| // call-site arguments would fail to compile rather than silently misbehave. |
There was a problem hiding this comment.
but those two:
std::chrono::nanoseconds max_time_jump_allowed,
std::chrono::nanoseconds sync_debounce_threshold,
Are easily swappable. Maybe the order of args could be changed
Signed-off-by: Maciej Salwa <maciej.salwa.ext@qorix.ai>
Signed-off-by: Maciej Salwa <maciej.salwa.ext@qorix.ai>
Signed-off-by: Maciej Salwa <maciej.salwa.ext@qorix.ai>
873aa0b to
96907e6
Compare
Description
Starting on #77, found that
QA / Clang-TidyandQA / Sanitizersshow green but aren'tactually checking anything.
Clang-Tidy: under
--config=clang-tidy, most targets fail to build before the aspectruns (
clang: error: argument unused during compilation: '-stdlib=libc++' [-Werror,-Wunused-command-line-argument]).MODULE.bazeldefines two LLVM toolchains; theone used here never sets
stdlib, unlike the newerllvm_toolchain_coverageone. Fix:mirror
stdlib = {"": "stdc++"}onto it.Sanitizers: under
--config=asan_ubsan_lsan, every test is silently skipped(
Executed 0 out of 22 tests: 22 were skipped)..bazelrcset--@score_cpp_policies//sanitizers/flags:sanitizer=asan_ubsan_lsan, a flag removed in thescore_cpp_policiescommit this repo pins — real API is three bool flags (:asan,:ubsan,:lsan). Since none were set, the sanitizerrun_underwrapper is incompatible and everytest gets skipped. Fix: set the three bool flags.
Both look like they've been broken since #102 (2026-07-03), not a recent regression —
continue-on-error: trueon both jobs hid it.Turns out that wasn't the whole story. Once the build actually worked, digging further
showed clang-tidy was still only running its own narrow built-in default (
clang-diagnostic-*,clang-analyzer-*) instead of the S-CORE baseline — the baseline lives inscore_cpp_policies, butexternal/is a sibling ofscore/, not an ancestor, so clang-tidy'sown directory-walk config discovery could never reach it. Mirrored the baseline into
//:.clang-tidyand wired it vialocal_configs. That surfaced 552 real findings inscore/time_daemon/that had never actually been checked — fixed what's genuinely fixable(missing includes, redundant/missing default member inits, magic numbers, pass-by-value+move,
const-correctness, trailing return types, a duplicated global turned into a member) and added
specific justification comments for the suppressions that are the right call.
Results
bazel test --config=clang-tidy //score/time_daemon/...→ 22/22 pass, 0 clang-tidy findings(full S-CORE baseline, not just the built-in default).
bazel test --config=asan_ubsan_lsan --config=x86_64-linux //score/time_daemon/...→22/22 pass, zero skipped, zero sanitizer failures.
bazel test //:format.check→ 5/5 pass.No open findings, no unjustified suppressions — #77's acceptance criteria are met.
Scope note
These two potential bugs are repo-wide (
MODULE.bazel/.bazelrc), nottime_daemon-specific —also unblocks #76/#78/#79 and is a prerequisite for #111/#112. Open to splitting into its own
issue/PR if preferred.
Related ticket
closes #77