You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Shadowing a name from the outer scope is arguably OK, and it's certainly allowed by OPA. But it would be good if there was at least a custom (i.e. optional) rule that flagged this, as it's potentially confusing.
package p
import rego.v1
x :=1
r if {
x :=4
x ==4
}
Shadowing a name inside a rule can only be done if inside of a nested body, like a comprehension. Since that type of granularity is complex using the AST alone, it's fine if the first implementation of this rule only considers symbols defined in the package, like rules, functions and imports.
The text was updated successfully, but these errors were encountered:
Shadowing a name from the outer scope is arguably OK, and it's certainly allowed by OPA. But it would be good if there was at least a custom (i.e. optional) rule that flagged this, as it's potentially confusing.
Shadowing a name inside a rule can only be done if inside of a nested body, like a comprehension. Since that type of granularity is complex using the AST alone, it's fine if the first implementation of this rule only considers symbols defined in the package, like rules, functions and imports.
The text was updated successfully, but these errors were encountered: