How to write Rego with confidence? #39
-
We find writing Rego policies to be very error-prone. We use both the VS Code and IntelliJ extensions, but they both lack features like error-highlighting, auto-complete or IntelliSense. Most issues are small typos in a variable names or operators. How do you write policies with confidence? Any tips would be much appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi Michael! And thanks for bringing this up! I don't have a definitive answer, so I hope others can share their tips here as well, but here's some of my thoughts. As the OPA Survey 2021 showed, a better OPA debugging experience is at the top of the wish list for the OPA community at large. Improving that is, and will continue to be, a high priority for OPA development, and we'll see some improvements—like a new print function for debugging—in the next OPA release, with more improvements in the type of tooling you mention planned for later this year. Some things that I think would help the Rego authoring and debugging experience:
With that said, some things that are currently there already and which I feel aren't utilized fully by many:
The new print function, and its ability to print even undefined variables and values, will also help a lot in scenarios where you just want to quickly know what's going on inside of a rule or comprehension. While it sounds pretty simple I've been running with the dev build of OPA for a week or two, and it's really very nice to work with. Hope others will find it as useful as I do! |
Beta Was this translation helpful? Give feedback.
Hi Michael!
And thanks for bringing this up! I don't have a definitive answer, so I hope others can share their tips here as well, but here's some of my thoughts.
As the OPA Survey 2021 showed, a better OPA debugging experience is at the top of the wish list for the OPA community at large. Improving that is, and will continue to be, a high priority for OPA development, and we'll see some improvements—like a new print function for debugging—in the next OPA release, with more improvements in the type of tooling you mention planned for later this year.
Some things that I think would help the Rego authoring and debugging experience: