Documentation
¶
Overview ¶
Package smell implements advisory complexity smell rules (SM1–SM8). Each rule fires only on a provable SSA pattern — the smell analogue of ⊤: when a detector cannot prove the pattern, it stays silent.
Smells are firewalled from verdicts: a smell never reads from or writes to a budget, a bound.Check result, or any verdict state. The analyzer runs the smell pass after and independent of the budget pass. Diagnostics carry the fixed prefix "smell(SMn):" so they form a class golangci-lint users filter on.
Discovery notes (Task 0 of the implementation plan):
- Constant-trip loops: tripcount.Of returns ⊤ for `for i := 0; i < 10; i++` (UpperExtent rejects a *ssa.Const bound), so constantTrip is detected structurally here, not via tripcount. ⊤ from tripcount is ambiguous (constant-trip AND data-dependent both read ⊤), which is why the loop family helpers below inspect the exit comparison directly.
- Ignore representation: //bigo:ignore reaches the analyzer as a verb in directive.FuncDirectives.Dirs, retrievable via directive.Verb(fd.Dirs, annotation.Ignore). The analyzer skips ignored decls before calling Detect.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AllRules = []string{"SM1", "SM2", "SM3", "SM4", "SM5", "SM6", "SM7", "SM8"}
AllRules is every smell rule, in canonical ID order.
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.