StyraInc / regal

Regal is a linter and language server for Rego, bringing your policy development experience to the next level!
https://docs.styra.com/regal
Apache License 2.0
253 stars 34 forks source link

Rule: `duplicate-annotation` #1126

Open anderseknert opened 1 week ago

anderseknert commented 1 week ago

I didn't know this worked until now, but it does:

# METADATA
# title: foo

# METADATA
# title: bar
rule := true

rego.metadata.rule() will simply return the last metadata block annotations, while chain() will give you all of them. I don't think it makes any sense to have duplicate, potentially "conflicting" annotations on the same scope, like in the example above. We should of course still allow the same attributes to descripe different scopes though (e.g. one description for document and one for rule).

Not sure about the category, but I would think this is likely a mistake, so leaniing towards bugs.