Skip to main content

Rules

This page contains an index of all 101 Regal rules.

CategoryIDSummary
Bugsbugs/annotation-without-metadata

Annotation without metadata

Bugsbugs/argument-always-wildcard

Argument is always a wildcard

Bugsbugs/constant-condition

Constant condition

Bugsbugs/deprecated-builtin

Constant condition

Bugsbugs/duplicate-rule

Duplicate rule

Bugsbugs/if-empty-object

Empty object following if

Bugsbugs/if-object-literal

Object literal following if

Bugsbugs/import-shadows-rule

Import shadows rule

Bugsbugs/impossible-not

Impossible not condition

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

Bugsbugs/inconsistent-args

Inconsistently named function arguments

Bugsbugs/internal-entrypoint

Entrypoint can't be marked internal

Bugsbugs/invalid-metadata-attribute

Invalid attribute in metadata annotation

Bugsbugs/leaked-internal-reference

Outside reference to internal rule or function

Bugsbugs/not-equals-in-loop

Use of != in loop

Bugsbugs/redundant-existence-check

Redundant existence check

Bugsbugs/redundant-loop-count

Redundant count before loop

Bugsbugs/rule-assigns-default

Rule assigned its default value

Bugsbugs/rule-named-if

Rule named if

Bugsbugs/rule-shadows-builtin

Rule name shadows built-in

Bugsbugs/sprintf-arguments-mismatch

Mismatch in sprintf arguments count

Bugsbugs/time-now-ns-twice

Repeated calls to time.now_ns

Bugsbugs/top-level-iteration

Iteration in top-level assignment

Bugsbugs/unassigned-return-value

Non-boolean return value unassigned

Bugsbugs/unused-output-variable

Unused output variable

Bugsbugs/var-shadows-builtin

Variable shadows built-in

Bugsbugs/zero-arity-function

Avoid functions without args

Customcustom/forbidden-function-call

Forbidden function call

Customcustom/missing-metadata

Package or rule missing metadata

Customcustom/naming-convention

Naming convention violation

Customcustom/narrow-argument

Function argument can be narrowed

Customcustom/one-liner-rule

Rule body could be made a one-liner

Customcustom/prefer-value-in-head

Prefer value in rule head

Idiomaticidiomatic/ambiguous-scope

Ambiguous metadata scope

Idiomaticidiomatic/boolean-assignment

Prefer if over boolean assignment

Idiomaticidiomatic/custom-has-key-construct

Custom function may be replaced by in and object.keys

Idiomaticidiomatic/custom-in-construct

Custom function may be replaced by in keyword

Idiomaticidiomatic/directory-package-mismatch

Directory structure should mirror package

Idiomaticidiomatic/equals-pattern-matching

Prefer pattern matching in function arguments

Idiomaticidiomatic/in-wildcard-key

Unnecessary wildcard key

Idiomaticidiomatic/no-defined-entrypoint

Missing entrypoint annotation

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

Idiomaticidiomatic/non-raw-regex-pattern

Use raw strings for regex patterns

Automatically fixable: Yes

Idiomaticidiomatic/prefer-set-or-object-rule

Prefer set or object rule over comprehension

Idiomaticidiomatic/single-item-in

Avoid in for single item collection

Idiomaticidiomatic/use-contains

Use the contains keyword

Idiomaticidiomatic/use-if

Use the if keyword

Idiomaticidiomatic/use-in-operator

Use in to check for membership

Idiomaticidiomatic/use-object-keys

Prefer to use object.keys

Idiomaticidiomatic/use-some-for-output-vars

Use some to declare output variables

Idiomaticidiomatic/use-strings-count

Use strings.count where possible

Importsimports/avoid-importing-input

Avoid importing input

Importsimports/circular-import

Avoid circular imports

Importsimports/confusing-alias

Confusing alias of existing import

Importsimports/ignored-import

Reference ignores import

Importsimports/implicit-future-keywords

Implicit future keywords

Importsimports/import-after-rule

Import declared after rule

Importsimports/import-shadows-builtin

Import shadows built-in namespace

Importsimports/import-shadows-import

Import shadows import

Importsimports/pointless-import

Importing own package is pointless

Importsimports/prefer-package-imports

Prefer importing packages over rules

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

Importsimports/redundant-alias

Redundant alias

Importsimports/redundant-data-import

Redundant import of data

Importsimports/unresolved-import

Unresolved import

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

Importsimports/unresolved-reference

Unresolved Reference

Importsimports/use-rego-v1

Use import rego.v1

Automatically fixable: Yes

Performanceperformance/defer-assignment

Assignment can be deferred

Performanceperformance/non-loop-expression

Non loop expression in loop

Performanceperformance/walk-no-path

Call to walk can be optimized

Performanceperformance/with-outside-test-context

with used outside of test context

Stylestyle/avoid-get-and-list-prefix

Avoid get_ and list_ prefix for rules and functions

Stylestyle/chained-rule-body

Avoid chaining rule bodies

Stylestyle/comprehension-term-assignment

Assignment can be moved to comprehension term

Stylestyle/default-over-else

Prefer default assignment over fallback else

Stylestyle/default-over-not

Prefer default assignment over negated condition

Stylestyle/detached-metadata

Detached metadata annotation

Stylestyle/double-negative

Avoid double negatives

Stylestyle/external-reference

External reference in function

Stylestyle/file-length

Max file length exceeded

Stylestyle/function-arg-return

Return value assigned in function argument

Stylestyle/line-length

Line too long

Stylestyle/messy-rule

Messy incremental rule

Stylestyle/mixed-iteration

Mixed iteration style

Stylestyle/no-whitespace-comment

Comment should start with whitespace

Automatically fixable: Yes

Stylestyle/opa-fmt

File should be formatted with opa fmt

Automatically fixable: Yes

Stylestyle/pointless-reassignment

Pointless reassignment of variable

Stylestyle/prefer-snake-case

Prefer snake_case for names

Stylestyle/prefer-some-in-iteration

Prefer some .. in for iteration

Stylestyle/rule-length

Max rule length exceeded

Stylestyle/rule-name-repeats-package

Avoid repeating package path in rule names

Stylestyle/todo-comment

Avoid TODO Comments

Stylestyle/trailing-default-rule

Default rule should be declared first

Stylestyle/unconditional-assignment

Unconditional assignment in rule body

Stylestyle/unnecessary-some

Unnecessary use of some

Stylestyle/use-assignment-operator

Prefer := over = for assignment

Automatically fixable: Yes

Stylestyle/yoda-condition

Yoda condition, it is

Testingtesting/dubious-print-sprintf

Dubious use of print and sprintf

Testingtesting/file-missing-test-suffix

Files containing tests should have a _test.rego suffix

Testingtesting/identically-named-tests

Multiple tests with same name

Testingtesting/metasyntactic-variable

Metasyntactic variable name

Testingtesting/print-or-trace-call

Call to print or trace function

Testingtesting/test-outside-test-package

Test outside of test package

Testingtesting/todo-test

TODO test encountered