Skip to main content
strata rule prints the complete metadata for one rule: its family, severity, whether it is on by default, its source, and its full message and remediation. Use it to understand a code you saw in strata check output, or to read what a rule claims before you enable or disable it.
strata rule CODE [--color MODE]

Usage

strata rule SFS131
SFS131 no-complex-comprehensions
Family: shape
Severity: error
Kind: core
Enabled by default: yes
Source: core
Message: nested or multi-generator comprehensions hide control flow and data shapes
Remediation: Rewrite this as ordinary statements with named intermediate values. Use explicit loops
             when needed, and extract a helper only when the transformation is a distinct operation.
The lookup is case-insensitive, so strata rule sfs131 works too.

Fields

FieldMeaning
HeaderThe code and slug.
FamilyThe rule’s family.
Severityerror or warning.
Kindcore for shipped rules, custom for your own.
Enabled by defaultWhether the rule runs without being named explicitly.
Sourcecore, or the file or module a custom rule was loaded from.
MessageThe one-sentence statement of the violated contract.
RemediationThe normal correction, or None provided. if the rule sets none.

Custom and configured rules

strata rule reads the whole catalogue for the current repository, so it resolves custom rules once they are configured, and it can inspect rules that are ignored or off by default. A custom rule shows its source path:
strata rule XAC001
XAC001 no-acme-global
Family: custom
Severity: error
Kind: custom
Enabled by default: yes
Source: scripts/strata_rules/rules/boundaries.py
Message: ACME_GLOBAL hides ownership
Remediation: Move the value to the module that owns and produces it.

Options

OptionValuesDefaultPurpose
--colorauto, always, neverautoANSI color behavior. Respects NO_COLOR.

Exit codes

CodeMeaning
0The rule was found and printed.
2The code is not a known rule.
An unknown code reports:
Unknown rule code: NOPE