Add routeCheckout (messy demo — should be caught) - #2
Closed
JordanCoin wants to merge 2 commits into
Closed
Conversation
crap4swift — changed-function risk{
"base" : "3b45ed2e208ea4e298f04c628c562d2125f2293f",
"functions" : [
{
"complexity" : 11,
"coverage" : 0,
"crap" : 132,
"endLine" : 18,
"file" : "/__w/crap4swift/crap4swift/Sources/CrapCore/Checkout.swift",
"function" : "routeCheckout(…)",
"lint" : [
{
"line" : 6,
"reason" : "Force casts should be avoided",
"rule" : "force_cast",
"severity" : "Error"
},
{
"line" : 6,
"reason" : "Variable name 'p' should be between 3 and 40 characters long",
"rule" : "identifier_name",
"severity" : "Error"
},
{
"line" : 15,
"reason" : "Variable name 'q' should be between 3 and 40 characters long",
"rule" : "identifier_name",
"severity" : "Error"
}
],
"overThreshold" : true,
"startLine" : 5
}
],
"summary" : {
"count" : 1,
"overThreshold" : 1,
"worst" : "routeCheckout(…)"
},
"threshold" : 30
} |
Owner
Author
|
Closing — this was a deliberate demo of crap4swift catching untested, high-CRAP, lint-flagged code (red by design). It served its purpose; the auto-posted risk-map comment stays visible here as an example. Not for merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 crap4swift review — the "caught" showcase
This PR adds
routeCheckout(_:_:), deliberately messy: high complexity, no tests, andseveral SwiftLint violations. crap4swift, scoped to just this diff, flags all of it:
routeCheckout(…)Verdict: request-changes. CRAP 132 (≫ threshold 30) — 11 branches, zero coverage.
Plus a
force_cast(line 6) and short identifiersp/q. This is exactly the kind ofchange a reviewer should stop: complex, untested, and unsafe. The CI check fails by
design — the gate caught it.
The auto-posted comment below carries the full risk map (CRAP + SwiftLint) for the
review agent to reason about. Compare with #1, where the same shape of function passed
once it was tested.