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-importsChecks that from X import Y imports only sub-modules, not objects. |
Import style (KIS) | ✅ 🛠️ |
KIS002 |
import-alias-policyChecks that from X import Y as Z only renames when needed to avoid a collision. |
Import style (KIS) | ✅ 🛠️ ⚠️ |
KNQ001 |
noqa-justificationRequires a reason on every # noqa suppression comment. |
noqa comments (KNQ) | |
KNQ002 |
noqa-styleRequires the reason on a # noqa comment to be its own # ... comment. |
noqa comments (KNQ) | 🛠️ |
KNQ003 |
unused-noqaFlags # noqa codes that suppress no konform violation. |
noqa comments (KNQ) | 🛠️ |
KPT* |
user-defined-patternsChecks files against user-defined regex patterns from konform_patterns.toml. |
User-defined patterns (KPT) | ✅ |
KST* |
structural-rulesChecks 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.