Regal v0.23.0 released! #600
anderseknert
started this conversation in
Ecosystem
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is a release adds 3 new linter rules to Regal, greatly improved completion suggestions in the language server, and a number of other improvements and fixes.
New rule:
leaked-internal-reference
Category:
bugs
Following the recently added style guide recommendation to use underscore prefixes to denote internal rules and functions, this was the first rule to help enforce that convention. The
leaked-internal-reference
rule will flag any reference to a rule or function with an underscore prefix that is not defined in the same package:For more information, see the docs on leaked-internal-reference.
New rule:
internal-entrypoint
Category:
bugs
Rules annotated as entrypoints are public by definition and must not be prefixed with an underscore.
Avoid
Prefer
For more information, see the docs on internal-entrypoint.
New rule:
ambiguous-scope
Category:
idiomatic
The default scope for metadata annotating a rule is the
rule
scope, which applies to the individual rule statement only. This default is sensible for a rule defined only once, but is somewhat ambiguous for a rule defined incrementally, like theallow
rule in the examples below. Was the intention really to annotate that single definition, or the rule as whole? Most likely the latter.If only a single rule in a group of incremental rule definitions is annotated, it should have it's
scope
set explicitly to eitherdocument
orrule
. If all incremental definitions are annotated, explicitscope: rule
is not required.Avoid
Prefer
Or (scope
rule
implied, but all incremental definitions annotated)Or (scope
rule
explicit)For more information, see the docs on ambiguous-scope.
For more information about the
scope
metadata attribute, see the OPA docs.Language server: Greatly improved completion suggestions
Last release introduced a minimal implementation of code completion, which means that the language server supports providing completion suggestions while editing Rego in an editor that supports the Regal languge server, such as VS Code using the OPA VS Code extension.
This release provides greatly improved completion suggestions, including:
import
,default
,contains
,if
input
attributes based on those previously usedallow
anddeny
Using completion suggestions now feels like a total game changer for productivity, and we really recommend trying it out!
Other improvements
Docs
docs
directoryBugs fixed
input
ordata
in ignored-importregal fix
command (thanks @oren-zohar for reporting the issue!)Breaking changes
These changes do not affect regular users of Regal, but possibly power users that have built their own custom rules relying on these helpers.
regal.json_pretty
built-in function. Users can now usejson.marshal_with_options
from OPA instead.ast.name
function in favor ofast.ref_to_string
Thank you to all contributors, community members and users! 🎉
If you have any questions, would like to discuss the release, or talk about Regal in general, you'll find us in the Styra Community Slack!
Full changelog and downloads here.
Beta Was this translation helpful? Give feedback.
All reactions