Regal v0.25.0 released #624
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
Uh oh!
There was an error while loading. Please reload this page.
-
This release brings 2 new rules to the Regal linter as well as a number of improvements to the Regal Language Server.
Rules
New rule
unused-output-variable
Category:
bugs
In this example, if
x
is unused later in the rule, it is considered an unused output variable.Unused output variables should be replaced by wildcards (
_
), as it makes it clear that the variable isn't going to be used.For more information, see the docs on unused-output-variable.
New rule
use-strings-count
Category:
idiomatic
strings.count
is a new OPA built-in function and should be used in place of counting indexes (count(indexof_n("foobarbaz", "a"))
) as was common before.Not only is
strings.count
more readable, but it also performs better.For more information, see the docs on use-strings-count.
Other Rule Updates
The
argument-always-wildcard
rule will now ignoremock_
prefixed functions by default, as wildcard arguments are commonly used in mocked functions.Linter
regal lint
. This can be used by e.g. GitLab CI/CD jobs to have linter violations printed in the code view in GitLab merge requests. Thanks @sebhoss for the work on this one!use-strings-count
rule.--var-values
flag fromopa test
(added to OPA in v0.66.0) is now supported by theregal test
command. This allows custom policy authors to see the the variable values in scope of a failed test.Regal Language Server
Code Lens Support
Regal now provides a Code Lens for direct evaluation of packages or rules within the editor, providing immediate feedback. In supported editors, you can now evaluate a package or rule by pressing "Evaluate" above its declaration, with the results displayed in-line.
code.lens.eval.mov
Input data provided via
input.json
, anddata.json
/data.yaml
files from bundle directories in the workspace are also available at evaluation time.Improved Formatter
The language server can now be configured to use
regal fix
as a formatter when saving buffers. In VS Code, settingopa.formatter
toregal-fix
will enable this feature.Other editors can use this by setting the
initializationOptions.formatter
.New Contributors
Thanks @rinx for their work on creating the Regal Nix package! (and updating our docs) and @sebhoss for the JUnit output format.
Downloads
Get your copy at the v0.25.0 release page!
Beta Was this translation helpful? Give feedback.
All reactions