Documentation
¶
Overview ¶
Package goidiomatic is a pedagogical Go-idiom linter.
Rules live under the rules/ subpackage. Each rule implements the Rule interface and ships with golden fixtures under rules/testdata/<id>/ (ok.go for code that must not flag, bad.go for code that must flag).
The Score function aggregates rule findings into a 0..100 score, deducting per severity level.
See https://github.com/CivNode/go-idiomatic for details.
Index ¶
Constants ¶
Severity levels re-exported from the rules package so callers can write goidiomatic.Error etc. without importing the subpackage directly.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Finding ¶
Finding is one hit on a Rule.
func Score ¶
Score parses src, runs each rule against it, and returns an aggregate score on [0, 100] plus all findings. The score starts at 100 and deducts 15 per Error, 7 per Warn, 2 per Info, floored at 0.
Score is deliberately single-file and loader-free so callers can grade snippets straight from memory. For package-level analysis use the analyzer exposed by the rules package with the standard analysis driver instead.
type Rule ¶
Rule is a single pedagogical check.
func DefaultRules ¶
func DefaultRules() []Rule
DefaultRules returns the built-in ruleset in a stable order. The returned slice is a fresh copy; callers may reorder or extend it without affecting future calls.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
go-idiomatic
command
Command go-idiomatic runs the pedagogical Go-idiom checks from the go-idiomatic module as a standalone linter driven by the standard golang.org/x/tools/go/analysis framework.
|
Command go-idiomatic runs the pedagogical Go-idiom checks from the go-idiomatic module as a standalone linter driven by the standard golang.org/x/tools/go/analysis framework. |
|
Package rules implements the built-in pedagogical rules for go-idiomatic.
|
Package rules implements the built-in pedagogical rules for go-idiomatic. |