Skip to main content

Rules

This page contains an index of all 100 Regal rules.

CategoryIDSummary
Bugsannotation-without-metadata

Annotation without metadata

Bugsargument-always-wildcard

Argument is always a wildcard

Bugsconstant-condition

Constant condition

Bugsdeprecated-builtin

Constant condition

Bugsduplicate-rule

Duplicate rule

Bugsif-empty-object

Empty object following if

Bugsif-object-literal

Object literal following if

Bugsimport-shadows-rule

Import shadows rule

Bugsimpossible-not

Impossible not condition

Type: Aggregate - runs both on single files as well as when more than one file is provided for linting

Bugsinconsistent-args

Inconsistently named function arguments

Bugsinternal-entrypoint

Entrypoint can't be marked internal

Bugsinvalid-metadata-attribute

Invalid attribute in metadata annotation

Bugsleaked-internal-reference

Outside reference to internal rule or function

Bugsnot-equals-in-loop

Use of != in loop

Bugsredundant-existence-check

Redundant existence check

Bugsredundant-loop-count

Redundant count before loop

Bugsrule-assigns-default

Rule assigned its default value

Bugsrule-named-if

Rule named if

Bugsrule-shadows-builtin

Rule name shadows built-in

Bugssprintf-arguments-mismatch

Mismatch in sprintf arguments count

Bugstime-now-ns-twice

Repeated calls to time.now_ns

Bugstop-level-iteration

Iteration in top-level assignment

Bugsunassigned-return-value

Non-boolean return value unassigned

Bugsunused-output-variable

Unused output variable

Bugsvar-shadows-builtin

Variable shadows built-in

Bugszero-arity-function

Avoid functions without args

Customforbidden-function-call

Forbidden function call

Custommissing-metadata

Package or rule missing metadata

Customnaming-convention

Naming convention violation

Customnarrow-argument

Function argument can be narrowed

Customone-liner-rule

Rule body could be made a one-liner

Customprefer-value-in-head

Prefer value in rule head

Idiomaticambiguous-scope

Ambiguous metadata scope

Idiomaticboolean-assignment

Prefer if over boolean assignment

Idiomaticcustom-has-key-construct

Custom function may be replaced by in and object.keys

Idiomaticcustom-in-construct

Custom function may be replaced by in keyword

Idiomaticdirectory-package-mismatch

Directory structure should mirror package

Idiomaticequals-pattern-matching

Prefer pattern matching in function arguments

Idiomaticin-wildcard-key

Unnecessary wildcard key

Idiomaticno-defined-entrypoint

Missing entrypoint annotation

Type: Aggregate - only runs when more than one file is provided for linting

Idiomaticnon-raw-regex-pattern

Use raw strings for regex patterns

Automatically fixable: Yes

Idiomaticprefer-set-or-object-rule

Prefer set or object rule over comprehension

Idiomaticuse-contains

Use the contains keyword

Idiomaticuse-if

Use the if keyword

Idiomaticuse-object-keys

Prefer to use object.keys

Idiomaticuse-some-for-output-vars

Use some to declare output variables

Idiomaticuse-strings-count

Use strings.count where possible

Importsavoid-importing-input

Avoid importing input

Importscircular-import

Avoid circular imports

Importsconfusing-alias

Confusing alias of existing import

Importsignored-import

Reference ignores import

Importsimplicit-future-keywords

Implicit future keywords

Importsimport-after-rule

Import declared after rule

Importsimport-shadows-builtin

Import shadows built-in namespace

Importsimport-shadows-import

Import shadows import

Importsprefer-package-imports

Prefer importing packages over rules

Type: Aggregate - only runs when more than one file is provided for linting

Importsredundant-alias

Redundant alias

Importsredundant-data-import

Redundant import of data

Importsunresolved-import

Unresolved import

Type: Aggregate - only runs when more than one file is provided for linting

Importsuse-rego-v1

Use import rego.v1

Automatically fixable: Yes

Performancedefer-assignment

Assignment can be deferred

Performancenon-loop-expression

Non loop expression in loop

Performancewalk-no-path

Call to walk can be optimized

Performancewith-outside-test-context

with used outside of test context

Styleavoid-get-and-list-prefix

Avoid get_ and list_ prefix for rules and functions

Stylechained-rule-body

Avoid chaining rule bodies

Stylecomprehension-term-assignment

Assignment can be moved to comprehension term

Styledefault-over-else

Prefer default assignment over fallback else

Styledefault-over-not

Prefer default assignment over negated condition

Styledetached-metadata

Detached metadata annotation

Styledouble-negative

Avoid double negatives

Styleexternal-reference

External reference in function

Stylefile-length

Max file length exceeded

Stylefunction-arg-return

Return value assigned in function argument

Styleline-length

Line too long

Stylemessy-rule

Messy incremental rule

Stylemixed-iteration

Mixed iteration style

Styleno-whitespace-comment

Comment should start with whitespace

Automatically fixable: Yes

Styleopa-fmt

File should be formatted with opa fmt

Automatically fixable: Yes

Stylepointless-reassignment

Pointless reassignment of variable

Styleprefer-snake-case

Prefer snake_case for names

Styleprefer-some-in-iteration

Prefer some .. in for iteration

Stylerule-length

Max rule length exceeded

Stylerule-name-repeats-package

Avoid repeating package path in rule names

Styletodo-comment

Avoid TODO Comments

Styletrailing-default-rule

Default rule should be declared first

Styleunconditional-assignment

Unconditional assignment in rule body

Styleunnecessary-some

Unnecessary use of some

Styleuse-assignment-operator

Prefer := over = for assignment

Automatically fixable: Yes

Styleyoda-condition

Yoda condition, it is

Testingdubious-print-sprintf

Dubious use of print and sprintf

Testingfile-missing-test-suffix

Files containing tests should have a _test.rego suffix

Testingidentically-named-tests

Multiple tests with same name

Testingmetasyntactic-variable

Metasyntactic variable name

Testingprint-or-trace-call

Call to print or trace function

Testingtest-outside-test-package

Test outside of test package

Testingtodo-test

TODO test encountered