docs/projects/regal/rules/bugs/if-empty-object.md
This rule has been deprecated and replaced by the if-object-literal rule. Documentation kept here only for the sake of posterity.
Summary: Empty object following if
Category: Bugs
Avoid
package policy
allow if {}
An empty rule body would previously be considered an error by OPA. With the introduction, and use of the if keyword,
that is no longer the case. In fact, empty {} is not considered a rule body at all, but rather an empty object,
meaning that if {} will always evaluate. This is likely a mistake, and while hopefully caught by tests, should be
avoided.
This linter rule provides the following configuration options:
rules:
bugs:
if-empty-object:
# one of "error", "warning", "ignore"
level: error