open-policy-agent / opa-idea-plugin

Open Policy Agent plugin for IntelliJ
MIT License
56 stars 22 forks source link

Error using expression inside of array index #146

Open anderseknert opened 1 year ago

anderseknert commented 1 year ago

Could be the problem is more generic that this, but the plugin currently flags this line on the -1 location, which should be valid Rego.

is_path(path, x) := path[count(path) - 1] == x
vgramer commented 1 year ago

Hey @anderseknert, i can not reproduce this one. if it's a parsing problem (the plugin flags your file as invalid with an error pointing on -1location ), may you provide me the complete rego file? Otherwise, give me instructions to reproduce it.

anderseknert commented 1 year ago

Hey @vgramer 👋 It looks like the plugin is missing support for the latest IDEA / Goland, so I'm unable to test this currently. Is that fix about to be pushed? Once it is, I'll come back to this and will try and provide a reproducible example, or close if it's not present.

vgramer commented 1 year ago

I publish the new version of the plugin with support for the last IDE versions, it should be available after the JB team review.

anderseknert commented 1 year ago

Thanks for the update! 👍 It's still flagged as an error for me. This is probably the simplest case to reproduce:

package p

import future.keywords.if

foo if input[1 - 1]

Obviously a nonsensical policy, but it's a valid one. The - is shown as an error though.