---
title: "Suppress checks"
description: "Suppress Strider checks inline or for an entire file."
image: "https://strider.gempir.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://strider.gempir.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Suppress checks

Use a source directive when a finding is intentional and changing the code
would make it less clear or correct. Keep the exception next to the code and
add a comment explaining why it is necessary.

## Suppress the next declaration or statement

Place `//strider:ignore` immediately before the declaration or statement that
should be exempt. List the check code after the directive:

```go
// The registry is intentionally shared by every request.
//strider:ignore no-package-var
var registry = newRegistry()
```

The directive applies to the next declaration or statement. To suppress more
than one check there, separate the codes with commas:

```go
// Kept as one function to mirror the protocol state machine.
//strider:ignore cognitive-complexity,cyclomatic-complexity
func advanceState() {
	// ...
}
```

Use `all` to suppress every source-local check on that declaration or
statement:

```go
// Generated by the protocol compiler.
//strider:ignore all
func generatedHandler() {
	// ...
}
```

Prefer named codes when possible so readers can see which exceptions are
intentional.

## Suppress checks for a file

Place `//strider:ignore-file` before the `package` clause to suppress one or
more source-local checks throughout a file:

```go
// Generated code; regenerate it instead of editing it.
//strider:ignore-file no-package-var,no-init
package legacy
```

The file-level directive also accepts `all`.

## Skip formatting for a file

Use the formatter-specific directive to leave an entire file unchanged:

```go
//strider:format-ignore
package legacy
```

This directive must appear in a header comment before the `package` clause. It
applies to `strider fmt` and to the `format` check.

## Checks that cannot be suppressed inline

Inline directives apply only to checks that report against local source
declarations or statements. Checks that reason across packages must instead
use a per-rule path exclusion in `strider.toml` or a [baseline](/baselines/).

Strider does not currently report stale or unused suppression codes, so remove
directives when the corresponding exception is no longer needed.

Source: https://strider.gempir.com/suppress/index.mdx
