This release changes what PickCheck fails on and lets it judge a branch
instead of the whole file. Cognitive complexity replaces cyclomatic
complexity as the default gate, so readable flat dispatch stops failing and
deeply nested conditions start. check --base checks everything a branch
changed since it forked, and compares each violation with the merge base, so a
one-line edit in a legacy function no longer fails on debt that was already
there when --fail-on excludes it.
Changes
- New
cognitivemetric, default limit 15, replaces cyclomaticcomplexity
as the default gate. It scores how hard control flow is to follow: a
switchormatchcosts 1 however many arms it has, and every branch or
loop costs more the deeper it is nested. The algorithm is pinned per
language indocs/spec.md. (#7) complexityis still measured but its default limit is nownull, which
turns the check off. Add"limits": {"complexity": 15}to.pickcheck.json
to restore the old gate. Any limit, global or per language, now accepts
null. (#7)- This changes what fails on upgrade. Across 32,805 functions in 19
repositories, the old gate failed 118 and the new one fails 220: 27 stop
failing, mostly long flatswitches, and 129 start, because they nest
conditions the old count could not see. (#7) - Dart
on T { }handlers without acatchnow count towardcomplexity.
(#24) &&inside Rust let chains (if let … && let …) now counts toward
complexityandbool_ops. (#26)check --base <ref>checks the functions a branch changed since it forked
from<ref>, committed or not, plus untracked files. It implies
--changed, and a stacked branch checked against its parent reports only
its own functions. (#29)- The
.pickcheck.json changed in this diffnote now also appears when the
config is deleted or renamed, not only when it is edited. (#32) - Dart mixin members are now reported as
Mixin.member, like class and
extension members, so their names in reports change. (#30) check --basecompares each violation with the same function at the merge
base and reports a status:new,worsened,unmatched,improved, or
unchanged.--fail-onpicks which statuses fail; the others print as
WARNand never fail the run. Without--fail-onevery violation still
fails, and hooks and plain--changedare unchanged. JSON gainsbase,
fail_on, and per-violationstatus,base_metrics, andlimits. (#30)
Validation
cargo test --workspace --locked --all-targets,cargo clippy --workspace --all-targets -- -D warnings,cargo run -- check crates, and
cargo llvm-cov --workspace --locked --fail-under-lines 94(94.23% lines)
pass onmainat fed4279: https://github.com/pickforge/pickcheck/actions/runs/36576086532- Golden fixtures cover every language, including hand-derived cognitive
values and the Dart mixin names. - The cognitive rollout numbers above come from scanning 32,805 functions in
19 repositories (#6). --baseand the baseline comparison are covered by CLI tests over real Git
repositories: committed, staged, unstaged and untracked changes, stacked
branches, renamed files, duplicate names, closure pairing, unreadable bases,
and--fail-onexit codes.
Known limits
- The baseline comparison matches functions by name within a file. A renamed
function, or one moved into a different file, counts asnew; a file
rename that Git detects keeps its functions paired. - Anonymous closures pair by position under their named owner. Adding or
removing a closure there makes its siblingsunmatched. - With several merge bases in a criss-cross history, Git's choice is used.
- Paths that are not valid UTF-8 are decoded lossily.
- Hooks still check against
HEADand never compare with a base.
Download pickcheck 0.4.0
| File | Platform | Checksum |
|---|---|---|
| pickcheck-aarch64-apple-darwin.tar.xz | Apple Silicon macOS | checksum |
| pickcheck-x86_64-apple-darwin.tar.xz | Intel macOS | checksum |
| pickcheck-x86_64-pc-windows-msvc.zip | x64 Windows | checksum |
| pickcheck-aarch64-unknown-linux-gnu.tar.xz | ARM64 Linux | checksum |
| pickcheck-x86_64-unknown-linux-gnu.tar.xz | x64 Linux | checksum |