Skip to content

Add severity(forCrap:threshold:) band classifier - #1

Closed
JordanCoin wants to merge 5 commits into
mainfrom
demo/severity-labels
Closed

Add severity(forCrap:threshold:) band classifier#1
JordanCoin wants to merge 5 commits into
mainfrom
demo/severity-labels

Conversation

@JordanCoin

Copy link
Copy Markdown
Owner

🤖 crap4swift reviewed its own PR

This PR adds severity(forCrap:threshold:). Scoped to just this diff, crap4swift flagged it:

CRAP CC Coverage Function
42 ⚠️ 6 0% severity(forCrap:threshold:) — CrapCore/Severity.swift:5

Verdict: approve-with-tests. Six branches, zero coverage → CRAP 42 (> threshold 30). The logic isn't dangerous, but it's untested branching. Add one test hitting each band (trivial / low / watch / high / severe / critical) and CRAP drops from 42 to 6.

Risk map — crap4swift --spm . --changed main --format review
{
  "base" : "main",
  "functions" : [
    {
      "complexity" : 6,
      "coverage" : 0,
      "crap" : 42,
      "endLine" : 12,
      "file" : "/Users/jordan/Code/crap4swift/Sources/CrapCore/Severity.swift",
      "function" : "severity(…)",
      "lint" : [

      ],
      "overThreshold" : true,
      "startLine" : 5
    }
  ],
  "summary" : {
    "count" : 1,
    "overThreshold" : 1,
    "worst" : "severity(…)"
  },
  "threshold" : 30
}

This review was generated by the tool in this repo, running against its own diff on a fresh swift test coverage run. That's the pitch: hand your AI reviewer a measured risk map, not a blind diff.

Copilot AI review requested due to automatic review settings July 24, 2026 06:54

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

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

crap4swift — changed-function risk

{
  "base" : "81babb68f8375c96c7cdc87dd0f10ac7fffa67a8",
  "functions" : [
    {
      "complexity" : 6,
      "coverage" : 1,
      "crap" : 6,
      "endLine" : 12,
      "file" : "/__w/crap4swift/crap4swift/Sources/CrapCore/Severity.swift",
      "function" : "severity(…)",
      "lint" : [

      ],
      "overThreshold" : false,
      "startLine" : 5
    }
  ],
  "summary" : {
    "count" : 1,
    "overThreshold" : 0,
    "worst" : "severity(…)"
  },
  "threshold" : 30
}

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@JordanCoin

Copy link
Copy Markdown
Owner Author

Closing — a green demo of the PR-review pipeline. severity() isn't used by the tool, so there's nothing to merge into main. The passing check + review comment remain as an example.

@JordanCoin JordanCoin closed this Jul 29, 2026
@JordanCoin
JordanCoin deleted the demo/severity-labels 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.

3 participants