Back to Opa

rule-shadows-builtin

docs/projects/regal/rules/bugs/rule-shadows-builtin.md

1.16.11.1 KB
Original Source

rule-shadows-builtin

Summary: Rule name shadows built-in

Category: Bugs

Avoid

rego
package policy

# `or` is an operator
or := 1 + 1

# `startswith` is a built-in function
startswith := indexof("rego", "r")

Rationale

Using the name of built-in functions or operators as rule and variable names can lead to confusion and unexpected behavior.

Configuration Options

This linter rule provides the following configuration options:

yaml
rules:
  bugs:
    rule-shadows-builtin:
      # one of "error", "warning", "ignore"
      level: error