Repository navigation
fix(static): --per-file coverage for all static analyzers (rebased onto main) - #24
Merged
Merged
Conversation
… reports (#21) Only static/complexity threaded the --per-file flag into its JSON builder; the imports/halstead/cohesion handlers dropped it, so their sections never gained the per-file `files` array the reference implementation emits (StaticService.enrichWithPerFileData over the PerFileRetainer snapshots). The three walks now retain per-file snapshots (imports: the file's deduplicated import list; halstead: file-level scalars + the function range; cohesion: the visitor report's scalars, message, and functions) and new *_flags JSON entry points build one JSONFileEntry per analyzed file — function-free/import-free files included — between `issues` and `score`, in renderer.JSONFileEntry field order. handlers.rs passes the flag on the three json dispatch arms. Verified against the live Go reference binary on a mixed fixture (multi-function, function-free, import-free, markdown files): the `files` arrays are identical after the harness's set-order canonicalization. Adds red-first unit tests per handler (tempfile dev dependency) and fixes two trivial pre-existing clippy warnings in the crate (nonminimal_bool in shotness_run.rs, useless_vec in plot_sections/imports.rs).
…ones, and the multi-analyzer JSON merge (#22) Closes the gaps left by the previous commit so --per-file now matches the reference implementation across the whole static JSON surface: - static/comments: the walk retains per-file snapshots (scalars, the per-file message, undocumented-function names); entries carry per-file score/status, the six key metrics, the Documented/Undocumented distribution, and name-sorted undocumented issues. Parse-failure files fold as the reference buildEmptyResult snapshot ("No comments found"). - static/composition: one entry per WALKED file (raw-file analyzer — non-UAST files included). The reference retains the raw classify report, which lacks every aggregate key the section reads, so each entry is the degenerate empty-report section ("No files analyzed", zero metrics, info score) with only file_path varying — reproduced byte-for-byte. - static/clones: not PerFileModeEnabled in the reference, but EnrichWithPerFileData still initializes every section with an empty files array — the flag now adds `files: []` via a shared ensure_sections_files_key helper (the enrichment-initialization step). - static_multi_json: the STATIC_JSON_VALUE_BUILDERS table is now flag-aware and the run's --per-file flag is threaded from lib.rs, so every merged section carries files (real entries for retaining analyzers, the initialized empty array for clones). Verified against the live Go reference binary on a fixture with Go, markdown, plain-text, and binary files: the files arrays are identical (after set-order canonicalization) for all three single-analyzer runs AND the full `-a 'static/*' --per-file` merged run. Red-first unit tests added for each path plus the merge. Co-authored-by: Dmitriy <dmit8815@gmail.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
5 tasks done
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.
Summary
Replaces #23. The
--per-filefixes from #21 and #22 were merged intomerge/rust-rewrite-into-main, but since #20 the canonical branch ismain— so this branch cherry-picks the two fix commits directly ontomain:--per-filein imports, halstead, and cohesion JSON reports (originally fix(static): full --per-file support across all static analyzers and the multi-analyzer JSON merge #21)--per-filecoverage — comments, composition, clones, and the multi-analyzer JSON merge (originally fix(static): complete --per-file coverage — comments, composition, clones, and the multi-analyzer JSON merge #22)The resulting tree is content-identical to
merge/rust-rewrite-into-main(empty diff) — the three CI/test commits on that branch already reachedmainvia the #20 squash.Test plan
filesarrays previously verified byte-identical against the live Go oracle for all six static analyzers and the merged-a 'static/*' --per-filereport🤖 Generated with Claude Code
https://claude.ai/code/session_01YXDr64gTAFuMdZVDqWaw46