Repository navigation
Rules
Canonical source: docs/rules.md. That file is generated from the source by python scripts/gen_rules_doc.py and should not be edited by hand. After adding or changing rules, regenerate it; CI fails when it is stale.
On current main there are 322 rule ids (v1.4.0 had 320). The two added on main are TypeScript's typescript-ts-ignore and the style rule typescript-explicit-any; they ship in the next release.
| Group | Count (on main) |
|---|---|
| v1.2 rules (explicit ids) | 64 |
| Opt-in style rules (always INFO) | 73 |
| Rules with derived ids (v1.0/v1.1) | 185 |
Every finding carries a rule id (Issue.effective_rule_id; JSON rule_id; SARIF ruleId). Use it with --disable-rule ID or disabled_rules in the Python API (every file), or — on main, shipping in the next release — in a code-cleaner: ignore[rule-id] comment on the finding's own line.
Rules whose id contains / are the older v1.0/v1.1 rules: their id is derived from the category and message. Runtime parts of the message are shown as {...} in the doc; where such a part ends up in the id it is shown as * (for example security/hardcoded-* covers security/hardcoded-password, security/hardcoded-token, and similar).
Severity is the severity at the report site. Taint Tracking can raise the severity of a security finding on the same line; context such as literal-only arguments can lower it.
-
AI-mistake checks include
ai-hallucinated-import,ai-hallucinated-attribute, placeholders and stubs, TODOs, leftover debug output, and hardcoded secrets (ai-secret-token,ai-private-key, …). -
Taint rules use the
taint-*prefix (taint-sql-injection,taint-command-injection,taint-code-injection, and others). See Taint Tracking. -
SCRAWL rules use the
scrawl-*prefix (40 rules), including compile errors, labels, vote forms, Darmok idioms, and VM traps. See SCRAWL. -
Style rules are off by default, always INFO, and are enabled with
--style-rulesor--enable-rule ID. -
TypeScript (on
main) addstypescript-ts-ignoreandtypescript-explicit-any.
Look up a specific id, its default severity, category, languages, and source file in docs/rules.md.
To accept one finding on one line (not in v1.4.0; ships in the next release):
result = eval(expr) # code-cleaner: ignore[security/dangerous-use-of-eval]
token = load() # code-cleaner: ignore[ai-secret-token, taint-*] (several ids; * wildcards)
debug(value) # code-cleaner: ignore (every finding on this line)Each language uses its own comment marker (#, //, /* */, --, <!-- -->). A comment with a different rule id suppresses nothing, and only the line that carries the comment is affected. Suppressed findings do not count towards the score or the CI gate; the number dropped is in metrics['suppressed']. --no-inline-suppressions (or inline_suppressions: False, or inline-suppressions = false in [tool.code-cleaner]) ignores the comments and reports everything. --disable-rule ID still turns a rule off everywhere. Details: README: Inline suppressions.
Created by ML / ML Innovations Research Lab. Korg (AI assistant, Grok Bot), contributor. · Repository · Apache License 2.0
Start here
Using Code Cleaner
Contributing