opa icon indicating copy to clipboard operation
opa copied to clipboard

Forbid underscore as rule name

Open anderseknert opened this issue 1 year ago • 1 comments

Harmless, but still, a wildcard rule name doesn't make sense 😄

package p

_ if true
opa eval -f pretty -d p.rego data.p
{
  "$0": true
}

anderseknert avatar Jan 15 '25 15:01 anderseknert

Had a look at this, and have some code I can push to resole the issue. Had a test failure here though, and that test clearly suggests intention to allow _ as a rule name. I'm not sure why this would be though 🤔

https://github.com/open-policy-agent/opa/blob/2136920218ee3dbe8484cd8b98259945b667176b/v1/ast/parser_test.go#L2267-L2274

anderseknert avatar Feb 09 '25 09:02 anderseknert