Repository navigation
·
34 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
This release adds an API change check, new boundary rules and CRAP scores. It also makes fix safer, and the GitHub Action now meets the GitHub Marketplace rules.
cargo install cargo-fallow --lockedNew checks
cargo fallow api --base <REF>reports the public API changes of each published library. It lists the added, removed and changed items, and the crates and features that were added or removed. Theapi-removalsgate fails when an item was removed and the breaking part of the version did not change. The GitHub Action runs it withcommand: apiand thebaseinput.cargo fallow boundarieshas three new rule types. Item rules keep some packages from a workspace item, also throughuse, aliases and re-exports. Glob re-export rules find apub use <path>::*that reads a denied crate or module.cfgrules report a path from code that acfgbuild compiles to an item that the same build does not compile.boundaries.sourcesrules takescope = "production"andallow = [{ path, max }]. The first skips test code. The second lets a listed file have up tomaxmatches.cargo fallow depshas the opt-infeature-unification-driftrule. It reports a shared crate that gets other features incargo build -p <member>than incargo build --workspace.--coverage <LCOV>gives each function a CRAP score incomplexityandcheck. A function at or overmax-crap(default 30) is acomplexity-crapfinding.
Configuration
cyclomatic-policy = "flat-match"counts a flatmatch, for example a lookup table, as one decision. The default staysstandard.cargo fallow dupes --productionandproduction = trueleave test code out of the clone search.cargo fallow visibility --public-crateand thepublic-crateskey name the libraries that are an external API. Each other library gets each rule.cargo fallow checkaccepts--base <REF>and--staged, so onecheckrun covers thefile-growthgate. The GitHub Action passes itsbaseinput tocheck.
cargo fallow fix
fixformats each changed file withrustfmtwhen the file was formatted before the edits.--only <CHECK>and--skip <CHECK>limit the edits todepsorvisibility.fixleaves out an edit that adds a compiler warning. Before, a workspace that builds with-D warningscould break afterfixexited 0.
Changed behavior
- The SARIF level of a finding now follows its severity:
errorgiveserror, andwarngiveswarning. A gate flag no longer changes the level. Adepswarning is now a SARIFwarning, not anote. - With
code-duplication = "off", theduplication-thresholdgate still judges the percentage. To drop the gate, removethresholdfrom[workspace.metadata.fallow.dupes].
Fixes
cargo fallow visibilitygives credit to intra-doc links in more forms, sofixno longer breakscargo doc. It also no longer reports items wherepub(crate)causes a rustc or clippy error: a type in the signature of apubitem, a#[cfg(test)] pubitem in a private module, and an item that ausewith a written visibility re-exports.cargo fallow depscounts an intra-doc link to a dependency as a use.cargo fallow mutantsgives--locked,--offlineand--frozento each cargo call in the copies.- The GitHub Action fails the step when
base: autocannot read the base commit of a gate that needs it. Before, the growth gate passed without a check. - The GitHub Action and the GitLab template post no first comment for a clean run.
- The description of the GitHub Action now fits the Marketplace limit.
Performance
cargo fallow checkparses each file one time. On a large workspace, the run uses about 14% less CPU time.- The memory of
cargo fallow visibilitynow grows about linearly with the source size. On a generated 5 MB file, the peak memory goes from 8.9 GB to 1.5 GB, and the time from 33 s to 1.5 s.