Repository navigation
clang-tidy: the 54 deferred checks of twenty findings or fewer, 39 on and 15 off for good - #181
Merged
Merged
Conversation
… and 15 off for good The survey of #175 left 54 checks of the "for now" list with twenty findings or fewer, some 350 across the three targets, the host tests and the fuzzers. Each is answered here, and all 54 leave the count list. On, with what they found fixed: - bugprone-derived-method-shadowing-base-method: OverlayDate, -Temperature and -Text each had a Task() that hid Overlay::Task() and did the same thing - restart the text once it had scrolled through. That is Overlay's now, through a fifth CRTP hook, SetText(); a call through the base can no longer skip it, and the three copies are gone. - clang-diagnostic-undef: MsgCmdDisplayPixelParser sized -I by WS2812_NUMBER_OF_LEDS, which nothing defines, so the comment beside it admitted the type was uint8 whatever the strip. It reads DISPLAY_NUMBER_OF_LEDS now; at 110 LEDs the type is uint8 as before. - readability-function-cognitive-complexity: the eight functions above 15 are split into named steps, the way CLAUDE.md asks - WriteOption() out of WriteCommands(), the two directions of AnimationSqueeze::ClearRow(), ShiftColumnTowardsCenter(), Text::SetFontIndex(), the message builder's FillOptionRow(), and the roll and colour-wheel tests' own helpers. - clang-diagnostic-deprecated-copy-with-dtor: the defaulted destructors of five value types, which said nothing and cost them their implicit copies' standing. - modernize-type-traits: the AVR's stand-in for <type_traits> gains the _v templates, and the core uses them; the stand-in's own definitions of _t and _v carry a NOLINT, being what the check asks for. - readability-redundant-typename: two were in a class that is no template; the third is needed in C++17 and is only redundant to the ESP32's database, which reads as C++23, so it has a NOLINT. - the mechanical rest by clang-tidy's own fixes, repaired by hand where the overlapping fixes of several translation units broke a constructor's initialiser list: isolate-declaration, simplify-boolean-expr, redundant-nested-if, -parentheses, -access-specifiers, loop-convert, use-default-member-init, prefer-member-initializer, pro-type-member-init, use-using, use-override, use-nullptr, implicit-bool-conversion and the like. - NOLINT with its reason where the code is right: a self-comparison that is the test, the XPM icon, wx's protected virtual destructors, the one recursion of the simulator's decoder, the stateless second base of MsgCmdOverlayParser, the rp2350 core's global __FlashStringHelper, GPIO_OUT, and Itoa, whose likeness to ltoa is the C library's. - cppcoreguidelines-avoid-non-const-global-variables with AllowInternalLinkage, so a module's state in an anonymous namespace is the file's own. Off for good, each with its reason in .clang-tidy: bugprone-throwing-static-initialization (cert-err58-cpp's other name), clang-diagnostic-enum-enum-conversion, cppcoreguidelines-avoid- do-while, -pro-type-reinterpret-cast, -pro-type-vararg, -use-enum-class, google-runtime-int and -float, misc-non-private-member-variables-in-classes, modernize-raw-string-literal, -use-constraints, readability-redundant-casting, -suspicious-call-argument, -use-anyofallof and -use-std-min-max. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
platformio.ini said C++17 and unflagged -std=gnu++11, but the framework's cpp_flags put
-std=gnu++2b and -std=gnu++2a after the project's -std=gnu++17, and the last one wins: the ESP32
firmware was C++20, and so was its clang-tidy database, while the AVR, the RP2350, the
simulator and the tests are C++17. Both flags are unflagged now. The firmware builds without a
warning, 8 bytes of flash larger.
What C++20 had papered over: std::atomic<int> value-initialises itself there and not in C++17,
so the web interface's client table is initialised with {} now (the constructor writes every
slot anyway; cppcoreguidelines-pro-type-member-init found it).
What it had caused: the NOLINT on the typename of MsgCmdOverlayParser, redundant only to C++20,
is gone, and modernize-use-constraints, which only reported where requires exists, is on - it
finds nothing in C++17. The previous commit called the ESP32's dialect C++23; it was C++20.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #180, which makes
maingreen again; merge that first and this one retargets tomain.The survey of #175 left 54 checks in the "for now" list with twenty findings or fewer, about 350 in all across the three targets, the host tests and the fuzzers. Each check is settled here: 40 are now on with what they found fixed, and 14 are off for good with a reason in
.clang-tidy. All 54 leave the count list. The three bigger checks that sat between them (avoid-const-or-ref-data-members,math-missing-parentheses,redundant-member-init) stay deferred, as before.What the checks found that was worth more than style
Task()that hidOverlay::Task(), and all three did the same thing: restart the text once it had scrolled through. That now lives inOverlaybehind a fifth CRTP hook,SetText(). A call through the base can no longer skip it, and the three copies are gone.MsgCmdDisplayPixelParsersized-IbyWS2812_NUMBER_OF_LEDS, which nothing defines. The comment beside it admitted as much. It now readsDISPLAY_NUMBER_OF_LEDS. At 110 LEDs the type stays uint8, so behaviour does not change.Off for good, and why not the obvious fix
WriteBit<algorithm>is not in the AVR's stdreadability-redundant-typenamestays on. Two of its findings were in a non-template class and are fixed. The third was only redundant in C++20, which leads to the next section.The ESP32 was C++20
platformio.inisaid C++17 but only unflagged-std=gnu++11. The framework'scpp_flagsappend-std=gnu++2b -std=gnu++2aafter our-std=gnu++17, and the last one wins. So the ESP32 firmware, and its clang-tidy database with it, was C++20. The AVR, the RP2350, the simulator and the tests are all C++17. Both flags are now unflagged too:typenameNOLINT is gone.modernize-use-constraintsis on: it finds nothing in C++17.std::atomic<int>value-initialises itself only in C++20, so the web interface's client table gets{}.Measured
tools/tidy.sh: no findings on avr128da48, esp32, rp2350, the host tests and the fuzzers.make lint,make headers,cmake --workflow --preset default,make host-esp32 host-rp2350: pass.ci-avr(warnings as errors), pluspio runfor both esp32 and rp2350, build cleanly.clang-tidy's
-fixwas used for the mechanical checks. Where the overlapping fixes from several translation units broke an initialiser list, the code was repaired by hand. Every hunk was read.🤖 Generated with Claude Code