Rules
This page contains an index of all 101 Regal rules.
Rule | Summary |
---|---|
bugs/annotation-without-metadata | Annotation without metadata |
bugs/argument-always-wildcard | Argument is always a wildcard |
bugs/constant-condition | Constant condition |
bugs/deprecated-builtin | Constant condition |
bugs/duplicate-rule | Duplicate rule |
bugs/if-empty-object | Empty object following `if` |
bugs/if-object-literal | Object literal following `if` |
bugs/import-shadows-rule | Import shadows rule |
bugs/impossible-not | Impossible `not` condition |
bugs/inconsistent-args | Inconsistently named function arguments |
bugs/internal-entrypoint | Entrypoint can't be marked internal |
bugs/invalid-metadata-attribute | Invalid attribute in metadata annotation |
bugs/leaked-internal-reference | Outside reference to internal rule or function |
bugs/not-equals-in-loop | Use of != in loop |
bugs/redundant-existence-check | Redundant existence check |
bugs/redundant-loop-count | Redundant count before loop |
bugs/rule-assigns-default | Rule assigned its default value |
bugs/rule-named-if | Rule named `if` |
bugs/rule-shadows-builtin | Rule name shadows built-in |
bugs/sprintf-arguments-mismatch | Mismatch in `sprintf` arguments count |
bugs/time-now-ns-twice | Repeated calls to `time.now_ns` |
bugs/top-level-iteration | Iteration in top-level assignment |
bugs/unassigned-return-value | Non-boolean return value unassigned |
bugs/unused-output-variable | Unused output variable |
bugs/var-shadows-builtin | Variable shadows built-in |
bugs/zero-arity-function | Avoid functions without args |
custom/forbidden-function-call | Forbidden function call |
custom/missing-metadata | Package or rule missing metadata |
custom/naming-convention | Naming convention violation |
custom/narrow-argument | Function argument can be narrowed |
custom/one-liner-rule | Rule body could be made a one-liner |
custom/prefer-value-in-head | Prefer value in rule head |
idiomatic/ambiguous-scope | Ambiguous metadata scope |
idiomatic/boolean-assignment | Prefer `if` over boolean assignment |
idiomatic/custom-has-key-construct | Custom function may be replaced by `in` and `object.keys` |
idiomatic/custom-in-construct | Custom function may be replaced by `in` keyword |
idiomatic/directory-package-mismatch | Directory structure should mirror package |
idiomatic/equals-pattern-matching | Prefer pattern matching in function arguments |
idiomatic/in-wildcard-key | Unnecessary wildcard key |
idiomatic/no-defined-entrypoint | Missing entrypoint annotation |
idiomatic/non-raw-regex-pattern | Use raw strings for regex patterns |
idiomatic/prefer-set-or-object-rule | Prefer set or object rule over comprehension |
idiomatic/single-item-in | Avoid `in` for single item collection |
idiomatic/use-contains | Use the `contains` keyword |
idiomatic/use-if | Use the `if` keyword |
idiomatic/use-in-operator | Use `in` to check for membership |
idiomatic/use-object-keys | Prefer to use `object.keys` |
idiomatic/use-some-for-output-vars | Use `some` to declare output variables |
idiomatic/use-strings-count | Use `strings.count` where possible |
imports/avoid-importing-input | Avoid importing `input` |
imports/circular-import | Avoid circular imports |
imports/confusing-alias | Confusing alias of existing import |
imports/ignored-import | Reference ignores import |
imports/implicit-future-keywords | Implicit future keywords |
imports/import-after-rule | Import declared after rule |
imports/import-shadows-builtin | Import shadows built-in namespace |
imports/import-shadows-import | Import shadows import |
imports/pointless-import | Importing own package is pointless |
imports/prefer-package-imports | Prefer importing packages over rules |
imports/redundant-alias | Redundant alias |
imports/redundant-data-import | Redundant import of data |
imports/unresolved-import | Unresolved import |
imports/unresolved-reference | Unresolved Reference |
imports/use-rego-v1 | Use `import rego.v1` |
performance/defer-assignment | Assignment can be deferred |
performance/non-loop-expression | Non loop expression in loop |
performance/walk-no-path | Call to `walk` can be optimized |
performance/with-outside-test-context | `with` used outside of test context |
style/avoid-get-and-list-prefix | Avoid `get_` and `list_` prefix for rules and functions |
style/chained-rule-body | Avoid chaining rule bodies |
style/comprehension-term-assignment | Assignment can be moved to comprehension term |
style/default-over-else | Prefer default assignment over fallback `else` |
style/default-over-not | Prefer default assignment over negated condition |
style/detached-metadata | Detached metadata annotation |
style/double-negative | Avoid double negatives |
style/external-reference | External reference in function |
style/file-length | Max file length exceeded |
style/function-arg-return | Return value assigned in function argument |
style/line-length | Line too long |
style/messy-rule | Messy incremental rule |
style/mixed-iteration | Mixed iteration style |
style/no-whitespace-comment | Comment should start with whitespace |
style/opa-fmt | File should be formatted with `opa fmt` |
style/pointless-reassignment | Pointless reassignment of variable |
style/prefer-snake-case | Prefer snake_case for names |
style/prefer-some-in-iteration | Prefer `some .. in` for iteration |
style/rule-length | Max rule length exceeded |
style/rule-name-repeats-package | Avoid repeating package path in rule names |
style/todo-comment | Avoid TODO Comments |
style/trailing-default-rule | Default rule should be declared first |
style/unconditional-assignment | Unconditional assignment in rule body |
style/unnecessary-some | Unnecessary use of `some` |
style/use-assignment-operator | Prefer `:=` over `=` for assignment |
style/yoda-condition | Yoda condition, it is |
testing/dubious-print-sprintf | Dubious use of `print` and `sprintf` |
testing/file-missing-test-suffix | Files containing tests should have a `_test.rego` suffix |
testing/identically-named-tests | Multiple tests with same name |
testing/metasyntactic-variable | Metasyntactic variable name |
testing/print-or-trace-call | Call to `print` or `trace` function |
testing/test-outside-test-package | Test outside of test package |
testing/todo-test | TODO test encountered |