Every configuration key Strata reads, how it discovers config, and how to override thresholds and contracts.
Strata is configured with a strata.toml file or a [tool.strata] table in
pyproject.toml. Configuration declares the scopes Strata scans, the rules it
runs, and the thresholds and contracts it enforces.
strata check, strata rule, and strata skills load configuration by searching
upward from the current directory. In each directory, Strata looks for:
strata.toml
a pyproject.toml containing a [tool.strata] table
The nearest directory wins, and within a directory strata.toml takes
precedence over pyproject.toml. The first source found is used whole; sources are
never merged. If neither exists anywhere up the tree, Strata reports:
No strata config found; create strata.toml or [tool.strata].
A standalone strata.toml holds keys at the top level. In pyproject.toml, the
same keys live under [tool.strata]:
A rule runs if it is enabled by default and matches a selector in select,
or if it is named by its exact code in select.
A rule named in ignore never runs, whatever select says.
Selecting a family does not pull in that family’s opt-in (default-off) rules.
Only naming such a rule by its exact code turns it on (for example
select = ["SF", "SFS102"]).
The [thresholds] table overrides the shipped numeric defaults globally. Every key
must be a known threshold name (see Architecture model
for the list and defaults):
The [roles.<role>] tables override thresholds for one role only, layered on top
of the global values. Role names are the fixed Strata roles (for example main,
helpers, classes, models, types, constants, exceptions, entry).
The [contracts] table maps a function-name glob to a behavior that the naming
family enforces. Today the one supported behavior is no-return, meaning a
function matching the glob must not return a meaningful value.Strata ships these contracts by default:
Contracts use closed behavior categories rather than per-name lists, which keeps
the configuration from decaying into an unmanageable list of special cases. For a
behavior other than no-return, write a custom rule.
rule_paths entries are directories (or files) of .py modules containing
@rule-decorated functions. Each file is loaded under an isolated synthetic
module name so it cannot pollute your import namespace.
rule_modules entries are importable dotted module names, loaded with a normal
import.
Loaded custom rules merge with the core rules into one catalogue, so they appear in
strata check, strata rule, and strata skills once
configured. See Custom rules for the authoring API.