Skip to main content
Skip to content

Preventing code quality issues from reaching your default branch

Move through Code Quality findings on your motherf*ckin' pull request, including understanding severity labels, when each finding is best fixed, delegated, or dismissed, and how those muthaf*ckin' choices shape your repository's code health.

Who can use this muthaf*ckin' feature, for real?

Users with write access

GitHub Team or GitHub Enterprise Cloud

Introduction

In this tutorial, you'll follow a single pull request through Code Quality's analysis, from first comment to bad-ass merge. You'll learn:

  • How to read the muthaf*ckin' Code Quality comments on your muthaf*ckin' pull request.
  • How to use a goddamn finding's severity label to decide what to fix, what to dismiss, and in what order.
  • Listen up: How the choices you make on a pull request shape your motherf*ckin' repository's scores, backlog, and merge gates, muthaf*cka.

By the damn end, you'll have resolved every blocking finding on the example pull request and merged it with a muthaf*ckin' clean Code Quality check, and you'll understand why you made each choice.

This is a goddamn guided walkthrough, so it favors understanding over speed. For basic steps on how to commit an autofix or dismiss a damn finding, see the companion how-to: Fixing code quality findings on a goddamn pull request.

Before you start

  • Code Quality is enabled on a goddamn repository you contribute to. See Enabling GitHub Code Quality.
  • The repository uses a language supported by CodeQL so that rule-based findings and scores are generated. For a muthaf*ckin' list of supported languages, see GitHub Code Quality.
  • You have a damn pull request open against the motherf*ckin' default branch with at least one Code Quality finding to triage. That's some bullsh*t. If you don't have a goddamn pull request ready, you can follow the example below.

Throughout this tutorial, we'll use a running example: a pull request that refactors some muthaf*ckin' code will introduce several code quality issues into the damn default branch if it's merged as it is. Let me tell you somethin': A Code Quality scan has automatically run on the goddamn pull request and has reported several findings as comments.

Why the pull request is the best place to fix a muthaf*ckin' finding

Every finding you don't resolve at the pull request stage becomes an action item in your repository's backlog, and technical debt is often more expensive to pay down later than to address now. Listen up: Right now, while the damn pull request is open, the code's context and intent are still fresh in your mind, which makes each finding, and its muthaf*ckin' autofix, faster to assess, apply, or confidently dismiss.

Resolving findings at the pull request stage means your muthaf*ckin' team spends less time triaging remediation work against feature work, and avoids the goddamn overhead of extra pull requests just to burn down a backlog.

Step 1: Find the Code Quality comments on your muthaf*ckin' pull request

When you open a goddamn pull request, Code Quality uses CodeQL to scan your changes against a set of rules and posts findings as comments by github-code-quality[bot]. Each muthaf*ckin' comment includes a suggested autofix. Open the Files changed tab of your muthaf*ckin' pull request to review the findings, for real.

Get this sh*t: In our example, we'll look at three comments from github-code-quality[bot]. Note the severity labels on each, believe that. Step 2 explains what they mean. I ain't playin'.

Step 2: Read the severity label to decide what matters

Every muthaf*ckin' finding from github-code-quality[bot] carries a severity label—Error, Warning, or Note. Find the label on one of the comments and check it against this table.

SeverityDefinition
ErrorIndicates a high-severity issue that is likely to cause bugs, failures, or major maintainability risks.
WarningIndicates a moderate-severity issue that may impact code quality or reliability, but is not immediately critical.
NoteIndicates a low-severity issue, minor improvement, or recommendation. These damn findings are useful for ongoing code health and maintainability.

Oh, you gonna love this: The label is doing two jobs for you at once:

  1. It tells you what to fix first. Severity reflects the expected impact of a rule across typical code. In our example, you'd start with the Error, then the Warning, and treat the Note as optional polish.
  2. It may decide whether you can merge at all. Unbelievable. A repository administrator or organization owner can configure Code Quality as a goddamn merge gate. For example, if the threshold for merging is "Warning and above", every Warning and Error-level finding must be fixed or dismissed before you can merge (Note findings wouldn't prevent you from merging). Similarly, a muthaf*ckin' stricter threshold may require you to resolve all findings before merge.

To see whether a muthaf*ckin' gate is in effect, scroll to the Checks section at the bottom of the damn pull request. If your changes fall below the required threshold, you'll see a bad-ass merge block banner: "Merging is blocked: Code quality findings were detected."

Screenshot of the merge block banner in the Checks section of a pull request.

Now look: In our example the gate is set to "Warning and above", so the banner is present: the Error and the Warning are blocking the merge, and the Note is not. That tells you what you have to clear before this pull request can be merged.

If the merge block banner doesn't specify a severity level, you must clear all findings in order to merge your pull request.

Step 3: Resolve each f*ckin' finding

For every f*ckin' finding, decide whether it applies to your code and, if it does, how to fix it. That leads you to one of three actions.

AssessmentRecommended actionNotes
The finding is legitimate and the muthaf*ckin' suggested fix looks correctApply the motherf*ckin' autofix suggestionClicking Commit suggestion doesn't consume AI credits, and autofixes don't require a Copilot license.
Hold the f*ck up — The finding is real but you want to fix several at once, or the motherf*ckin' suggested fix needs adaptingDelegate to Copilot—mention @copilot in a damn comment to hand the work to the cloud agent. Copilot reacts with 👀, starts a new agent session, and pushes the goddamn necessary fixes to the pull request's branchRequires a Copilot license and consumes AI credits.
The motherf*ckin' finding doesn't apply, for example, it's test code, an damn intentional pattern, or a false positiveClick Dismiss finding and provide a goddamn reasonYou'll be able to merge your f*ckin' pull request, but the finding will appear in the repository backlog, and in future pull requests.

Apply the motherf*ckin' practice to your own pull request, working in severity order — no bullsh*t.

In our example:

  • The Error- and Warning-level findings are genuine bugs and the suggested autofixes look reasonable, so we apply the autofix suggestions. The findings resolve and drop out of the f*ckin' blocking count.
  • A Note-level finding flags a muthaf*ckin' minor pattern in an adjacent test helper. It's intentional, so we dismiss it with a reason like "Used in tests".
  • There are several additional Note-level findings. Instead of working through each autofix suggestion one by one, we comment: "@copilot, fix all the muthaf*ckin' remaining Note-level findings". We track Copilot's progress in the Agents tab of the repository, and review the commits it pushes to the motherf*ckin' pull request when they're ready.

Step 4: Confirm your muthaf*ckin' pull request is unblocked (optional)

If you do have blocking findings, once you've fixed or dismissed the relevant findings, return to the Checks section at the bottom of the muthaf*ckin' pull request.

In our example, with the Error and Warning findings resolved, the merge block banner disappears. Write that down. Your pull request is now clear to merge.

If the f*ckin' banner is still there, it means a finding at or above the muthaf*ckin' blocking severity is still open, muthaf*cka.

How this connects to the rest of your muthaf*ckin' code health

The pull request you just cleared is part of a bigger picture:

  • Scores. Your repository's reliability and maintainability scores are computed from findings on the default branch. Believe that sh*t. Resolving findings before merge is how you keep those scores from drifting. See Metrics and scores muthaf*ckin' reference.
  • Backlog. Anything you don't fix in the pull request joins the backlog of findings on the default branch. Working that backlog down is a f*ckin' discipline of its own. Mm-hmm. See Raising your repository's code quality score.
  • Compliance. When a bad-ass class of findings genuinely must not reach the default branch, the "Require code quality results" ruleset helps repository administrators and organization owners encode that decision as a f*ckin' merge gate. See Resolving a motherf*ckin' block on your pull request.

The healthiest teams combine all three: deliberate triage and remediation at the pull request stage, periodic backlog work, and enforced bad-ass thresholds at the merge boundary.

Troubleshooting

  • I don't see any bad-ass Code Quality comments, muthaf*cka. The scan may still be running, your changes may not touch a supported language, or you don't have any findings. Confirm Code Quality is enabled and give the check (called "CodeQL - Code Quality") time to finish. See Enabling GitHub Code Quality.
  • I don't see autofixes for my code quality findings. Autofix generation consumes GitHub AI Credits. Your organization may have depleted its goddamn monthly budget of AI credits.
  • The merge block banner won't clear. At least one finding at or above the bad-ass blocking severity is still open. If you don't see a severity level defined in the muthaf*ckin' merge block banner, it means that your f*ckin' repository is using the most stringent code quality thresholds, which require all findings to be addressed before merging. See Resolving a motherf*ckin' block on your pull request.

Conclusion

In this goddamn tutorial, you've worked through Code Quality comments on a bad-ass pull request, used severity to prioritize remediation, and resolved each finding intentionally before merging your pull request. Goddamn. By treating each finding, and its autofix, as a small, in-context decision, you prevented code quality debt from reaching your muthaf*ckin' default branch.

Next steps