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

# strata rule

> Inspect the full metadata for a single rule code, core or custom.

`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`](/cli/check) output, or to read
what a rule claims before you enable or disable it.

```bash theme={null}
strata rule CODE [--color MODE]
```

## Usage

```bash theme={null}
strata rule SFS131
```

```text theme={null}
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

| Field              | Meaning                                                           |
| ------------------ | ----------------------------------------------------------------- |
| Header             | The code and slug.                                                |
| Family             | The rule's [family](/concepts/rule-families).                     |
| Severity           | `error` or `warning`.                                             |
| Kind               | `core` for shipped rules, `custom` for your own.                  |
| Enabled by default | Whether the rule runs without being named explicitly.             |
| Source             | `core`, or the file or module a custom rule was loaded from.      |
| Message            | The one-sentence statement of the violated contract.              |
| Remediation        | The 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](/concepts/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:

```bash theme={null}
strata rule XAC001
```

```text theme={null}
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

| Option    | Values                    | Default | Purpose                                   |
| --------- | ------------------------- | ------- | ----------------------------------------- |
| `--color` | `auto`, `always`, `never` | `auto`  | ANSI color behavior. Respects `NO_COLOR`. |

## Exit codes

| Code | Meaning                         |
| ---- | ------------------------------- |
| `0`  | The rule was found and printed. |
| `2`  | The code is not a known rule.   |

An unknown code reports:

```text theme={null}
Unknown rule code: NOPE
```
