7.0.0
Major release: the refactoring suggestions are now a clippy-style lint
system with measured reductions, diff comparison gains a --staged mode
and a [tool.complexipy.diff] TOML section, and the deprecated output
flags and TOML keys are removed. Check the migration
guide before
upgrading.
Features
--suggest-refactorsis now a clippy-style lint system: stable rule IDs (C001–C005, C007, C011), category and applicability metadata,path:line:colanchors with caret spans, verbatim suggestion rendering, and a documentation link per rule. (#209)- Refactor-plan findings are included in JSON, SARIF, and GitLab exports when
--suggest-refactorsis passed; the SARIF rule catalog is built dynamically from the plans encountered. (#209) compute_diff,has_regressions,DiffEntry, andDiffStatusare now part of the public Python API, so CI tools can consume diff results as objects instead of parsing terminal output. (#210)collect_removable_ignored_locations()andRemovableIgnoreare exported from the Python API. Every run now reports ignore comments that are no longer necessary (path:line function=X complexity=N <comment>) when the suppressed function is back under the allowed limit. (#213)--stagedflag for git-index comparison — answers "what complexity am I about to commit?" instead of only what changed in the working tree;--stagedalone defaults the baseline toHEADand enforces, while--diff <ref> --stagedenforces against the ref. (#218)[tool.complexipy.diff]TOML section so the comparison policy lives in the repository config:branch = "main"makes a plaincomplexipy .run behave like--diff main(enforcement included),staged = trueenables staged comparison by default, andbranch = ""opts out. CLI flags take precedence over the section. (#219)- Refactor reductions are now measured instead of estimated: for every machine-applicable suggestion (C002, C007) the replacement is spliced into the source, re-parsed, and re-scored, so
estimated_reductionandestimated_complexity_afterreport the literal delta of applying the suggestion — and ranking, overlap resolution, and the noise filter all operate on measured values. The newreduction_is_measuredflag separates measured plans from help-only formula estimates, which the CLI renders with a~qualifier (Estimated reduction: ~-2) while measured plans render plain (Reduction: -2). Guard suggestions are now faithful splices for loops with statements before or after the if-chain and for multi-line loop headers; measurement failures fall back to the formula estimate — never a panic, never a fabricated number. (#225)
Fixed
- Snapshot updates now merge with the existing snapshot instead of replacing it: only the files analyzed in a run are touched, so partial runs (e.g. pre-commit hooks analyzing only staged files) no longer erase the baseline for unanalyzed files. (#215)
- The docs footer now renders its links as styled links instead of raw markdown text, on both the English and Spanish landing pages. (#216)
Changed
- Refactor-plan reduction estimates are now honest: the reduction math was rewritten and validated against measured before/after complexity, C004 no longer suggests splitting
matchstatements, C006 was deleted because its gate could never fire, and C011 now fires ontry→with→trychains. Overlapping plans are deduped against every overlap and capped at 5, reporting dropped ones as "... and N more suggestions". (#209) - Condition extraction in the refactor rules now tracks bracket depth, string literals, and walrus
:=instead of a naiverfind(':'). (#209) file_complexity()now returns cwd-relative paths (matchinggit diff --name-only), and nested invocations resolve git paths via agit ls-filesbasename lookup — without this, diffing per-file results silently marked every function as NEW. (#210)- Community standards files were added:
CODE_OF_CONDUCT.md,CONTRIBUTING.md,SECURITY.md, issue templates, and a pull request template. (#201)
Removed
RefactorPlan.steps— replaced by the concretesuggestion/helpfields on the plan. (#209)CodeSnippetfrom the public API;CodeSuggestionis exported in its place. (#209)--output-json/-j,--output-csv/-c,--output-gitlab, and--output-sarif/-sr— use--output-formatinstead. (#221)--ratchet/-R—--diffenforces the threshold by default. (#221)- TOML keys
output-json,output-csv,output-gitlab,output-sarif, flatstaged, flatratchet, and the undocumenteddetails = "low"alias. (#221)
PRs
- docs: add community standards files by @rohaquinlop in #201
- feat(refactor): make --suggest-refactors clippy-style and honest by @rohaquinlop in #209
- feat(api): expose diff analysis in the public Python API by @rohaquinlop in #210
- feat(ignore): report removable ignore comments automatically by @rohaquinlop in #213
- fix(snapshot): preserve baseline on partial runs by @rohaquinlop in #215
- docs(footer): fix footer markdown rendering by @rohaquinlop in #216
- feat(diff): add --staged for git-index comparison by @rohaquinlop in #218
- feat(diff): add TOML config for diff section by @rohaquinlop in #219
- refactor(cli): remove deprecated flags and TOML keys by @rohaquinlop in #221
- docs(changelog): add per-release changelog page by @rohaquinlop in #223
- feat(rules): measure refactor reductions instead of estimating them by @rohaquinlop in #225
Full Changelog: 6.2.0...7.0.0