Back to Opa

constant-condition

docs/projects/regal/rules/bugs/constant-condition.md

1.16.1883 B
Original Source

constant-condition

Summary: Constant condition

Category: Bugs

Automatically fixable: Yes

Avoid

rego
package policy

allow if {
    1 == 1
}

Prefer

rego
package policy

allow := true

Rationale

While most often a mistake, constant conditions are sometimes used as placeholders, or "TODO logic". While this is harmless, it has no place in production policy, and should be replaced or removed before deployment.

Configuration Options

This linter rule provides the following configuration options:

yaml
rules:
  bugs:
    constant-condition:
      # one of "error", "warning", "ignore"
      level: error