Skip to content

7.0.0

Choose a tag to compare

@rohaquinlop rohaquinlop released this 10 Aug 19:51
· 7 commits to main since this release

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-refactors is now a clippy-style lint system: stable rule IDs (C001–C005, C007, C011), category and applicability metadata, path:line:col anchors 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-refactors is passed; the SARIF rule catalog is built dynamically from the plans encountered. (#209)
  • compute_diff, has_regressions, DiffEntry, and DiffStatus are 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() and RemovableIgnore are 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)
  • --staged flag for git-index comparison — answers "what complexity am I about to commit?" instead of only what changed in the working tree; --staged alone defaults the baseline to HEAD and enforces, while --diff <ref> --staged enforces against the ref. (#218)
  • [tool.complexipy.diff] TOML section so the comparison policy lives in the repository config: branch = "main" makes a plain complexipy . run behave like --diff main (enforcement included), staged = true enables staged comparison by default, and branch = "" 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_reduction and estimated_complexity_after report the literal delta of applying the suggestion — and ranking, overlap resolution, and the noise filter all operate on measured values. The new reduction_is_measured flag 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 match statements, C006 was deleted because its gate could never fire, and C011 now fires on trywithtry chains. 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 naive rfind(':'). (#209)
  • file_complexity() now returns cwd-relative paths (matching git diff --name-only), and nested invocations resolve git paths via a git ls-files basename 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 concrete suggestion / help fields on the plan. (#209)
  • CodeSnippet from the public API; CodeSuggestion is exported in its place. (#209)
  • --output-json / -j, --output-csv / -c, --output-gitlab, and --output-sarif / -sr — use --output-format instead. (#221)
  • --ratchet / -R--diff enforces the threshold by default. (#221)
  • TOML keys output-json, output-csv, output-gitlab, output-sarif, flat staged, flat ratchet, and the undocumented details = "low" alias. (#221)

PRs

Full Changelog: 6.2.0...7.0.0