Skip to content

60 of 470 tracked C/C++ sources are outside clang-tidy-diff's reach, and 11 of them only because one CMake flag is missing #651

Description

@Yaraslaut

60 of 470 tracked C/C++ sources are outside clang-tidy-diff's reach, and 11 of them only because one CMake flag is missing

What this is

#481 widened the clang-tidy job's configure so examples/ would appear in
compile_commands.json at all, and deleted the -regex that used to exclude
it. PR #649 then added a filter to that job: a changed source with no entry
in the compile database is dropped from the diff before clang-tidy-diff.py
sees it, because clang tooling interpolates a neighbouring entry's compile
command and the result is a clang-diagnostic-error about the configure
rather than a finding about the changed line. Each drop is printed as a
::warning::.

That makes the hole visible instead of fatal. It does not close it. This issue
records its size and separates the part that is cheap to fix from the part
that is not.

Measurement

On 3c6dd24f (PR #649's head), with the clang-tidy job's own configure
flags, clang 22.1.8, Qt 6 present:

$ # every tracked C/C++ source vs. build/clang-debug/compile_commands.json
tracked C/C++ sources: 470
not in compile_commands.json: 60
    30  tests/lint
     9  examples/bank/gui
     9  examples/bank/gui_wasm
     6  tests/compile_checks
     2  examples/bank/tests
     1  examples/bookmarks/gui_wasm
     1  examples/common/wasm_spike
     1  examples/pastebin/gui_wasm
     1  examples/polls/gui_wasm

The database itself: 703 entries naming 695 distinct in-workspace sources, 270
of them under examples/.

The three groups are not the same problem

1. examples/bank/gui (9) and examples/bank/tests (2) — a missing flag,
nothing more.
The clang-tidy job passes -DMORPH_BUILD_BANK_EXAMPLE=ON
but not -DMORPH_BUILD_BANK_GUI=ON. examples/bank/CMakeLists.txt:159 gates
the GUI sources on the latter, and examples/bank/CMakeLists.txt:198 says the
bank controllers "only exist when MORPH_BUILD_BANK_GUI=ON", which is why the
two examples/bank/tests sources go with them. The linux-all-features job
already sets it (.github/workflows/ci.yml:1855), so these sources do build
on a native Linux Qt configure — they are simply not offered to the one job
that reads code. Adding the flag is a one-line change; it costs a wider
configure (more Qt Quick), which is why it is a decision and not a drive-by.

2. tests/lint (30) and tests/compile_checks (6) — not translation units
by design.
tests/lint/** are text fixtures scanned by shell checkers;
their own headers say "Nothing here is compiled" — that is #650, and PR #649's
filter changes that issue's option space (see the comment there).
tests/compile_checks/** are built by configure-time try_compile() /
try_run() with specific COMPILE_DEFINITIONS (-DMORPH_CLIENT_ONLY and
friends); analysing them under the ordinary flag set is meaningless, as
client_only_facade_no_model_header.cpp demonstrated by producing 17
clang-diagnostic-errors attributed upward into bridge.hpp, registry.hpp
and model.hpp.

3. The 13 WASM sources — need a toolchain this job does not have. Four
*/gui_wasm/main_wasm.cpp, examples/common/wasm_spike/main_wasm.cpp, and
nine under examples/bank/gui_wasm. wasm-ladder.yml and wasm-demo.yml
build them with Emscripten; neither runs clang-tidy (grep -l clang-tidy .github/workflows/*.yml matches only ci.yml and drift-guard.yml). So no
lint check of any kind has ever read a line of these files. Making the
clang-tidy job configure an Emscripten toolchain is a large change; running
clang-tidy inside the existing WASM legs may be cheaper, since they already
have the toolchain — but neither has been costed.

Verification status

Reproduced for the measurement above: the counts come from an actual local
configure with the job's flags, not from reading CMake. Read, not
reproduced:
the claim that adding -DMORPH_BUILD_BANK_GUI=ON brings the 11
bank sources into the database is inferred from
examples/bank/CMakeLists.txt:25,159,198 and from linux-all-features
setting the flag — I did not re-run the configure with it, and did not measure
what it costs in configure time. Not attempted: any clang-tidy run over
the WASM sources.

Also measured, and clean: bugprone-exception-escape over the three
compiled production sources (src/qt/qt_websocket_backend.cpp,
src/qt/qt_websocket_server.cpp, src/main.cpp) with
-checks='-*,bugprone-exception-escape' reports nothing. That probe was run
because PR #649 fixed a real instance of that check in a test double whose
destructor settles a Completion, and the same shape would be a
std::terminate in production; it does not appear there.

What would change the verdict

Close this when either (a) the bank GUI sources are in the clang-tidy job's
database, or the decision not to put them there is written down with its cost;
and (b) the WASM sources are lint-analysed somewhere, or the decision not to
is written down. Re-open — or rather, re-measure — if the "not in
compile_commands.json" count rises above 60 for a reason other than a new
tests/lint/ fixture directory.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: ciSubsystem: cienhancementNew feature or requesttriage: validWell-framed; implement as written

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions