Skip to main content

Rules

This page contains an index of all 101 Regal rules.

RuleSummary
bugs/annotation-without-metadataAnnotation without metadata
bugs/argument-always-wildcardArgument is always a wildcard
bugs/constant-conditionConstant condition
bugs/deprecated-builtinConstant condition
bugs/duplicate-ruleDuplicate rule
bugs/if-empty-objectEmpty object following `if`
bugs/if-object-literalObject literal following `if`
bugs/import-shadows-ruleImport shadows rule
bugs/impossible-notImpossible `not` condition
bugs/inconsistent-argsInconsistently named function arguments
bugs/internal-entrypointEntrypoint can't be marked internal
bugs/invalid-metadata-attributeInvalid attribute in metadata annotation
bugs/leaked-internal-referenceOutside reference to internal rule or function
bugs/not-equals-in-loopUse of != in loop
bugs/redundant-existence-checkRedundant existence check
bugs/redundant-loop-countRedundant count before loop
bugs/rule-assigns-defaultRule assigned its default value
bugs/rule-named-ifRule named `if`
bugs/rule-shadows-builtinRule name shadows built-in
bugs/sprintf-arguments-mismatchMismatch in `sprintf` arguments count
bugs/time-now-ns-twiceRepeated calls to `time.now_ns`
bugs/top-level-iterationIteration in top-level assignment
bugs/unassigned-return-valueNon-boolean return value unassigned
bugs/unused-output-variableUnused output variable
bugs/var-shadows-builtinVariable shadows built-in
bugs/zero-arity-functionAvoid functions without args
custom/forbidden-function-callForbidden function call
custom/missing-metadataPackage or rule missing metadata
custom/naming-conventionNaming convention violation
custom/narrow-argumentFunction argument can be narrowed
custom/one-liner-ruleRule body could be made a one-liner
custom/prefer-value-in-headPrefer value in rule head
idiomatic/ambiguous-scopeAmbiguous metadata scope
idiomatic/boolean-assignmentPrefer `if` over boolean assignment
idiomatic/custom-has-key-constructCustom function may be replaced by `in` and `object.keys`
idiomatic/custom-in-constructCustom function may be replaced by `in` keyword
idiomatic/directory-package-mismatchDirectory structure should mirror package
idiomatic/equals-pattern-matchingPrefer pattern matching in function arguments
idiomatic/in-wildcard-keyUnnecessary wildcard key
idiomatic/no-defined-entrypointMissing entrypoint annotation
idiomatic/non-raw-regex-patternUse raw strings for regex patterns
idiomatic/prefer-set-or-object-rulePrefer set or object rule over comprehension
idiomatic/single-item-inAvoid `in` for single item collection
idiomatic/use-containsUse the `contains` keyword
idiomatic/use-ifUse the `if` keyword
idiomatic/use-in-operatorUse `in` to check for membership
idiomatic/use-object-keysPrefer to use `object.keys`
idiomatic/use-some-for-output-varsUse `some` to declare output variables
idiomatic/use-strings-countUse `strings.count` where possible
imports/avoid-importing-inputAvoid importing `input`
imports/circular-importAvoid circular imports
imports/confusing-aliasConfusing alias of existing import
imports/ignored-importReference ignores import
imports/implicit-future-keywordsImplicit future keywords
imports/import-after-ruleImport declared after rule
imports/import-shadows-builtinImport shadows built-in namespace
imports/import-shadows-importImport shadows import
imports/pointless-importImporting own package is pointless
imports/prefer-package-importsPrefer importing packages over rules
imports/redundant-aliasRedundant alias
imports/redundant-data-importRedundant import of data
imports/unresolved-importUnresolved import
imports/unresolved-referenceUnresolved Reference
imports/use-rego-v1Use `import rego.v1`
performance/defer-assignmentAssignment can be deferred
performance/non-loop-expressionNon loop expression in loop
performance/walk-no-pathCall to `walk` can be optimized
performance/with-outside-test-context`with` used outside of test context
style/avoid-get-and-list-prefixAvoid `get_` and `list_` prefix for rules and functions
style/chained-rule-bodyAvoid chaining rule bodies
style/comprehension-term-assignmentAssignment can be moved to comprehension term
style/default-over-elsePrefer default assignment over fallback `else`
style/default-over-notPrefer default assignment over negated condition
style/detached-metadataDetached metadata annotation
style/double-negativeAvoid double negatives
style/external-referenceExternal reference in function
style/file-lengthMax file length exceeded
style/function-arg-returnReturn value assigned in function argument
style/line-lengthLine too long
style/messy-ruleMessy incremental rule
style/mixed-iterationMixed iteration style
style/no-whitespace-commentComment should start with whitespace
style/opa-fmtFile should be formatted with `opa fmt`
style/pointless-reassignmentPointless reassignment of variable
style/prefer-snake-casePrefer snake_case for names
style/prefer-some-in-iterationPrefer `some .. in` for iteration
style/rule-lengthMax rule length exceeded
style/rule-name-repeats-packageAvoid repeating package path in rule names
style/todo-commentAvoid TODO Comments
style/trailing-default-ruleDefault rule should be declared first
style/unconditional-assignmentUnconditional assignment in rule body
style/unnecessary-someUnnecessary use of `some`
style/use-assignment-operatorPrefer `:=` over `=` for assignment
style/yoda-conditionYoda condition, it is
testing/dubious-print-sprintfDubious use of `print` and `sprintf`
testing/file-missing-test-suffixFiles containing tests should have a `_test.rego` suffix
testing/identically-named-testsMultiple tests with same name
testing/metasyntactic-variableMetasyntactic variable name
testing/print-or-trace-callCall to `print` or `trace` function
testing/test-outside-test-packageTest outside of test package
testing/todo-testTODO test encountered