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
Section titled “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:
// The registry is intentionally shared by every request.//strider:ignore no-package-varvar registry = newRegistry()The directive applies to the next declaration or statement. To suppress more than one check there, separate the codes with commas:
// Kept as one function to mirror the protocol state machine.//strider:ignore cognitive-complexity,cyclomatic-complexityfunc advanceState() { // ...}Use all to suppress every source-local check on that declaration or
statement:
// Generated by the protocol compiler.//strider:ignore allfunc generatedHandler() { // ...}Prefer named codes when possible so readers can see which exceptions are intentional.
Suppress checks for a file
Section titled “Suppress checks for a file”Place //strider:ignore-file before the package clause to suppress one or
more source-local checks throughout a file:
// Generated code; regenerate it instead of editing it.//strider:ignore-file no-package-var,no-initpackage legacyThe file-level directive also accepts all.
Skip formatting for a file
Section titled “Skip formatting for a file”Use the formatter-specific directive to leave an entire file unchanged:
//strider:format-ignorepackage legacyThis 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
Section titled “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.
Strider does not currently report stale or unused suppression codes, so remove directives when the corresponding exception is no longer needed.