docs/projects/regal/rules/style/trailing-default-rule.md
Summary: Default rule should be declared first
Category: Style
Avoid
package policy
allow if {
# some conditions
}
default allow := false
Prefer
package policy
default allow := false
allow if {
# some conditions
}
Presenting the default value of a rule (if one is used) before the conditional rule assignments is a common practice, and it's often easier to to reason about conditional assignments knowing there is a default fallback value in place. For that reason, it's recommended to follow the convention and place the default rule declaration before rules conditionally assigning values.
This linter rule provides the following configuration options:
rules:
style:
trailing-default-rule:
# one of "error", "warning", "ignore"
level: error