Skip to content

Add routeCheckout (messy demo — should be caught) - #2

Closed
JordanCoin wants to merge 2 commits into
mainfrom
demo/messy-checkout
Closed

Add routeCheckout (messy demo — should be caught)#2
JordanCoin wants to merge 2 commits into
mainfrom
demo/messy-checkout

Conversation

@JordanCoin

Copy link
Copy Markdown
Owner

🤖 crap4swift review — the "caught" showcase

This PR adds routeCheckout(_:_:), deliberately messy: high complexity, no tests, and
several SwiftLint violations. crap4swift, scoped to just this diff, flags all of it:

CRAP CC Coverage Function Lint
132 ⚠️ 11 0% routeCheckout(…) force_cast + 2× identifier_name

Verdict: request-changes. CRAP 132 (≫ threshold 30) — 11 branches, zero coverage.
Plus a force_cast (line 6) and short identifiers p/q. This is exactly the kind of
change 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.

Copilot AI review requested due to automatic review settings July 24, 2026 07:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

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
}

@JordanCoin

Copy link
Copy Markdown
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.

@JordanCoin JordanCoin closed this Jul 29, 2026
@JordanCoin
JordanCoin deleted the demo/messy-checkout branch July 29, 2026 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants