Documentation
¶
Overview ¶
Package fix applies mechanically safe remediations.
Only rules whose remediation is provably semantics-preserving get a fix. Everything else is explain-only, because a linter that silently changes meaning is worse than one that merely complains. QD002, for instance, has no fix: choosing between relaxing the label and separating the directories is a decision about what the user meant, not a mechanical transformation.
Two properties are load-bearing and are asserted by test:
- Idempotence: applying a fix twice equals applying it once. Otherwise running the tool in CI would produce an endless diff.
- Locality: bytes outside the region a fix touches are unchanged. This is why the parser retains the original text of every line.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Change ¶
type Change struct {
// Path is the file to change. For a file that does not exist yet, such as
// the network unit QD030 creates, Created is true.
Path string
Before string
After string
Created bool
// Rules lists the rule IDs that contributed to this change.
Rules []string
}
Change is one file's worth of proposed edit.
type Options ¶
type Options struct {
// Only restricts fixing to these rule IDs. Empty means every fixable rule.
Only map[string]bool
}
Options control which fixes are applied.
Click to show internal directories.
Click to hide internal directories.