v0.24.0
This release brings 4 new rules to Regal's linter as well as a number of improvements to the language server.
Rules
New Rule if-object-literal
This rule helps users avoid an error case where an object follows an if
. Typically this represents an incomplete rule.
allow if {}
Read the docs on if-object-literal
.
New Rule pointless-reassignment
Variables in Rego are immutable, so adding a new variable for an existing short variable only adds noise. Read the docs on pointless-reassignment
.
New Rule argument-always-wildcard
Sometimes, particularly after refactoring, a function argument is always a wildcard (_
):
my_func(name, _)
my_func("Alice", _)
This rule catches such cases as they typically offer an opportunity for further refactoring or an error where the argument should be used in one or more cases. Read the docs on argument-always-wildcard
.
New Rule annotation-without-metadata
Rules containing METADATA
annotation syntax without a METADATA
header will not be parsed and represents a likely mistake.
# description: allow allows
allow if {
# ... some conditions
}
Read the docs on annotation-without-metadata
.
New Rule var-shadows-builtin
Variables that share the name of a built-in group or function should be renamed to avoid confusion.
# variable `http` shadows `http.send` built-in function
allow if {
http := startswith(input.url, "http://")
# ...
}
Read the docs on var-shadows-builtin
.
Regal Language Server
Snippet Completions
We have extended the support for completions to add snippets for some
and every
. Both key:value and collection formats are supported.
Screen.Recording.2024-07-16.at.17.31.42.mov
Example Links on Keyword and Built-in Hover
We've been building out a new documentation section called 'Rego By Example'. We have detailed guides here for some of the common keywords and built-in functions. Users can now browse directly to these from their editors by hovering over supported keywords and functions.
Screen.Recording.2024-07-16.at.17.34.05.mov
Supported:
- Keywords
some
andevery
- Function Groups
io.jwt
,regex
,time
, andcontains
- (more coming soon!)
Suggestions for Variables in Local Scope
We've got lots of completions providers now, this new one suggestions previously defined local variables like this:
Project Housekeeping
Start-up Version Check
With much work going into keeping a regular stream of updates, we felt it was important to help users stay up-to-date. In this release we have laid the groundwork for this by having Regal consult the latest releases on GitHub at startup and reporting if the current version is now outdated.
Please see Remote Features for more information and for instructions on how to disable this.
Use OSSF Scorecard
The OpenSSF Scorecard evaluates open source projects against security best practices to identify potential risks and areas for improvement. In this release we have added a workflow to scan the project on a schedule.
New Contributors
Thanks @maruloop for your first contribution to the project in #865 - and for working on this reviewdog integration for our project.
Changelog
- 96246a3: Skip nil check (#819) (@charlieegan3)
- b6588dc: Cache rq binary (#820) (@charlieegan3)
- 90b2bcc: Check Regal version at start-up (#824) (@charlieegan3)
- 53dbce6: Don't call completion providers inside of comments (#831) (@anderseknert)
- 3af7d06: Don't suggest
if
orcontains
following import (#834) (@anderseknert) - e3e12a9: Fix markdown content rendering for Zed editor (#829) (@anderseknert)
- 34fc452: Rule:
if-object-literal
(#835) (@anderseknert) - 5901874: Better support rule head keyword completions (#836) (@charlieegan3)
- b24bde4: lsp: perform no operation when processing events for ignored files (#837) (@charlieegan3)
- fb0250c: Completion suggestions for variables in local scope (#840) (@anderseknert)
- d8dda73: build(deps): bump github.com/spf13/cobra from 1.8.0 to 1.8.1 (#842) (@dependabot[bot])
- 8dd71c8: Add support for ignored files in ls formatting (#845) (@charlieegan3)
- 1edfd88: Completion of locals in more places (#847) (@anderseknert)
- 1191c41: Better
default
suggestions (#848) (@anderseknert) - 7bf1c93: [lsp] Implement rulerefs in rego (#849) (@charlieegan3)
- e9a2ab6: Add more to docs on
prefer-some-in-iteration
(#851) (@anderseknert) - 0536573: Port Import provider to Rego (#853) (@charlieegan3)
- d3dad61: Fix
top-level-iteration
false positive with ref head vars (#854) (@anderseknert) - 39e57db: Clear the store when reloading config (#855) (@charlieegan3)
- 82fd171: More Rego completion providers (#858) (@anderseknert)
- 72f63aa: Precompute refs in file at update (#859) (@charlieegan3)
- 5cb412d: Drop print statement (#860) (@charlieegan3)
- f082b73: Improve performance of rulerefs (#861) (@charlieegan3)
- 0175ee4: Add new blog to README (#862) (@anderseknert)
- ec060ef: Add reviewdog/action-regal to the adopters file (#865) (@maruloop)
- 3b5b83e: docs: update adopters and roadmap (#866) (@anderseknert)
- 2fa61d7: Completions: package name suggested from any path component (#869) (@anderseknert)
- 6cebb1c: Add snippets provider (#870) (@anderseknert)
- 5a61015: Add snippet suggestion for metadata annotation (#871) (@anderseknert)
- 0dad5f0: OPA v0.66.0 (#873) (@anderseknert)
- 300eef2: perf: refactor to avoid excessive
walk
ing (#877) (@anderseknert) - ce8b8ff: Rule:
pointless-reassignment
(#878) (@anderseknert) - 23c3bf5: Docs: add separate page for language server features (#880) (@anderseknert)
- 67de577: Use OSSF scorecard (#884) (@anderseknert)
- 6b6ffc4: [StepSecurity] ci: Harden GitHub Actions (#885) (@step-security-bot)
- a4c96a4: Fix token permissions (#886) (@anderseknert)
- 8110bc5: Rule:
argument-always-wildcard
(#883) (@anderseknert) - 6153d57: Rule:
annotation-without-metadata
(#882) (@anderseknert) - 0ed98f9: build(deps): bump ossf/scorecard-action from 2.3.1 to 2.3.3 (#890) (@dependabot[bot])
- b412ac9: build(deps): bump actions/checkout from 4.1.1 to 4.1.7 (#892) (@dependabot[bot])
- 1e597c8: build(deps): bump github/codeql-action from 3.24.9 to 3.25.11 (#889) (@dependabot[bot])
- 7773c3c: build(deps): bump actions/upload-artifact from 3.pre.node20 to 4.3.3 (#891) (@dependabot[bot])
- b7c7385: Rule:
var-shadows-builtin
(#893) (@anderseknert) - 4ec7018: Fix negative number returned by rulerefs provider issue (#894) (@anderseknert)
- d000d21: Remove used refs completion provider (#896) (@anderseknert)
- bb790c5: Completions:
rulerefs
optimizations (#898) (@anderseknert) - 812ab2b: Fix bug causing
prefer-some-in-iteration
not to be reported (#902) (@anderseknert) - a18e386: Fix some
prefer-snake-case
violations not getting reported (#900) (@anderseknert) - 35d6703: build(deps): bump actions/upload-artifact from 4.3.3 to 4.3.4 (#903) (@dependabot[bot])
- 288d9c3: rule: Fix pointless issue when using with (#907) (@charlieegan3)
- bcfc9b7: Dependabot/go modules/GitHub.com/owenrumney/go sarif/v2 2.3.3 (#909) (@charlieegan3)
- a6e97af: docs: Update language server docs (#910) (@charlieegan3)
- 1efd82c: lsp/hover: Show example links (#906) (@charlieegan3)
- aef7d59: build(deps): bump actions/setup-go from 5.0.1 to 5.0.2 (#911) (@dependabot[bot])
- bea3d66: build(deps): bump github/codeql-action from 3.25.11 to 3.25.12 (#912) (@dependabot[bot])
- 988d558: Show snippet completions for complete word (#914) (@charlieegan3)
- 9ed8ec1: Begin to Include end location where applicable (#917) (@anderseknert)
- 31bee8d: release: Add permissions to create releases (@charlieegan3)
- 34202b5: release: Add permissions to push to ghcr (@charlieegan3)
View Commits: v0.23.1...v0.24.0