Documentation
¶
Overview ¶
Package rules contains specific rules as subpackages to check a Makefile against
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterRule ¶
func RegisterRule(r Rule)
RegisterRule let's you register a rule for inclusion in the validator
Types ¶
type Rule ¶
type Rule interface {
Name() string
Description(cfg RuleConfig) string
Run(parser.Makefile, RuleConfig) RuleViolationList
}
Rule defines the interface that all validation rules must implement.
Each rule provides:
- Name(): a unique identifier string for the rule.
- Description(cfg RuleConfig): a human-readable explanation of what the rule checks for. Implementations should adapt the description based on the provided configuration, but must remain safe to call with a nil config (using default values).
- Run(makefile, cfg): performs the actual validation on the parsed Makefile, returning a list of any violations found.
func GetRulesSorted ¶
func GetRulesSorted() []Rule
GetRulesSorted returns all registered rules in alphabetical order by name.
type RuleConfig ¶
RuleConfig is a simple string/string map to hold key/value configuration for rules.
type RuleConfigMap ¶
type RuleConfigMap map[string]RuleConfig
RuleConfigMap is a map that stores RuleConfig maps keyed by the rule name
type RuleRegistry ¶
RuleRegistry is the type to hold rules keyed by their name
func GetRegisteredRules ¶
func GetRegisteredRules() RuleRegistry
GetRegisteredRules returns the internal ruleRegistry
type RuleViolation ¶
RuleViolation represents a basic validation failure
type RuleViolationList ¶
type RuleViolationList []RuleViolation
RuleViolationList is a list of Violation types and the return type of a Rule function
Directories
¶
| Path | Synopsis |
|---|---|
|
Package maxbodylength implements the ruleset for making sure target bodies are kept short and thus hopefully somewhat not complex.
|
Package maxbodylength implements the ruleset for making sure target bodies are kept short and thus hopefully somewhat not complex. |
|
Package minphony implements the ruleset for making sure required minimum phony targets are present
|
Package minphony implements the ruleset for making sure required minimum phony targets are present |
|
Package phonydeclared implements the ruleset for making sure all targets that don't have a rule body are marked PHONY
|
Package phonydeclared implements the ruleset for making sure all targets that don't have a rule body are marked PHONY |
|
Package timestampexpanded implements the ruleset for making sure a variable that likely represents a timestamp is simply expanded so it doesn't change in between rule executions.
|
Package timestampexpanded implements the ruleset for making sure a variable that likely represents a timestamp is simply expanded so it doesn't change in between rule executions. |
|
Package uniquetargets implements the ruleset ensuring no target is repeated.
|
Package uniquetargets implements the ruleset ensuring no target is repeated. |