Skip to content

Rules

konform supports an increasing list of opinionated rules not supported by Ruff. List them, including your project's own KPT patterns, with konform rule --list; read one with konform rule --explain <CODE>.

Legend

  • ✅: enabled by default
  • 🛠️: the rule has an auto-fix (--fix)
  • ⚠️: the fix is unsafe and needs --unsafe-fixes
Code Rule Linter Status
KIS001 module-only-imports
Checks that from X import Y imports only sub-modules, not objects.
Import style (KIS) ✅ 🛠️
KIS002 import-alias-policy
Checks that from X import Y as Z only renames when needed to avoid a collision.
Import style (KIS) ✅ 🛠️ ⚠️
KNQ001 noqa-justification
Requires a reason on every # noqa suppression comment.
noqa comments (KNQ)
KNQ002 noqa-style
Requires the reason on a # noqa comment to be its own # ... comment.
noqa comments (KNQ) 🛠️
KNQ003 unused-noqa
Flags # noqa codes that suppress no konform violation.
noqa comments (KNQ) 🛠️
KPT* user-defined-patterns
Checks files against user-defined regex patterns from konform_patterns.toml.
User-defined patterns (KPT) ✅
KST* structural-rules
Checks Python code structure against user-defined AST rules from konform_rules.toml.
User-defined structural rules (KST) ✅

Codes are prefix-matched in select, ignore, per-file-ignores and # noqa: KIS means every KIS* rule.