Releases: JordanCoin/crap4swift
Release list
v0.1.1
crap4swift v0.1.1 — a maintenance release, driven by the tool auditing itself.
crap4swift flagged its own main() at CRAP 1482 (cyclomatic complexity 38, untested). So this release extracts the CLI's argument parsing (Options.parse) and source discovery (SourceFiles.discover) into the library and unit-tests them:
main()drops from CC 38 → 9- argument parsing goes from untested → 84% covered
- No behavior changes — same flags, same output.
Also: README now leads with the one-command --spm usage and consolidates options into tables. 73 tests.
brew upgrade crap4swift # or: brew install JordanCoin/tap/crap4swiftUniversal (arm64 + x86_64) macOS binary attached. Full list: CHANGELOG.
v0.1.0 — crap4swift
crap4swift v0.1.0 — the first release of Change Risk Anti-Patterns for Swift.
Finds functions that are risky to change (complex and under-tested), and hands an AI reviewer a measured risk map instead of a blind diff.
CRAP(f) = CC(f)² · (1 − coverage(f))³ + CC(f)
What's in it
- Complexity via SwiftSyntax (SwiftLint-compatible rules) — result builders, macros, SwiftUI DSL parse exactly.
- Coverage from two worlds behind one interface —
swift test/llvm-cov(SPM, server-side) and Xcodexccov/.xcresult(iOS apps). - Two doors:
--spm <dir>and--xcodeproj <p> --scheme <s>run the tests themselves; or feed pre-generated coverage. - PR-native:
--changed <base>scopes to touched functions;--format reviewfuses CRAP + SwiftLint into agent-ready JSON. - Five formats:
human,json,review,sarif(GitHub Code Scanning),html(dashboard). - Regression gate:
--baseline+--fail-regression— fail only if a function got worse. - CI: a
pull_requestworkflow (Linux) that posts a risk-map comment, uploads SARIF, and gates. Exit codes:0clean ·1usage ·2over threshold.
Install (macOS)
brew install JordanCoin/tap/crap4swiftUniversal binary (arm64 + x86_64) attached below. Linux / from source: swift build -c release.
Credits
The CRAP metric is by Alberto Savoia & Bob Evans (crap4j, 2007). Inspired by unclebob/crap4java and minikin/cargo-crap.