-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support 2024.1 IDEA Version and Fix Minor Error False Positives #166
Support 2024.1 IDEA Version and Fix Minor Error False Positives #166
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just some nits / questions.
@@ -67,10 +67,10 @@ module ::= package (import| rule)* | |||
package ::= "package" ref | |||
import ::= "import" ref ( "as" var )? | |||
rule ::= "default"? rule-head rule-body* | |||
rule-head ::= var ( "(" rule-args? ")" )? ("[" term "]" )? ( ( ":=" | "=" ) expr )? | |||
rule-head ::= var ( "(" rule-args? ")" )? ("[" term "]" )* ( ( ":=" | "=" ) expr )? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this change mean in practice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It allows multidimensional array/object notation for the rule head, as an alternative to the dot notation. See the added test in the rule_head
test file for an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, gotcha! Thanks for bearing with me :)
src/main/grammar/Rego.bnf
Outdated
rule-args ::= term ( "," term )* | ||
rule-body ::= else-expr | query-block | ||
else-expr ::= else "=" expr query-block? | else "="? query-block | ||
else-expr ::= else (':=' | '=') expr query-block? | else "="? query-block |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be updated in the last expression too? i.e. the else "="?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps. I couldn't find a test case that I could test it on, so I chose to leave it alone. I can tweak it anyway, if desired?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have replicated the addition to the other expression and added a test to cover it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
input.x < input.y | ||
} else := { | ||
true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is assigning a new set containing true
as its only item. else := true
would probably make more sense here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good find. Assigning it true was my intent, but I also was trying to keep the test case style in line with the rest in the file and it worked, so I didn't think about it too hard. I'll address this.
* Grammar: multidimensional array rule heads considered valid * Grammar: else expressions no longer consider ':=' invalid * tests: bump OPA version to v0.61.0 Signed-off-by: Shane Poage <[email protected]>
9fda630
to
e6aa0ed
Compare
Thanks Shane! Much appreciated. Now just to try and figure out how to get this published, as I've never been involved in that before 😅 If you have experience publishing a plugin and could help provide some pointers, hit me up on the OPA Slack! |
@spoage Thanks for the work :) Just a clarification, this PR fixes compatibility for IDEA 2024.1 ( aka 241 in gradle, the new EAP) version on dev was already compatible with version 2023.3 (aka 233 in gradle). @anderseknert, I have a working PR that fixes the release-note generation and publishing of the plugin... But it is not opened yet as I have weird behavior. I will open PR this afternoon or tomorrow. |
Ah, very happy to hear that Vincent! 👍 Looking forward to having Rego in my IDEA IDE's once more :) |
Description
Fixes #165
Fixes #151