Skip to content

Update dependency StyraInc/regal to v0.33.1 #393

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

Merged
merged 1 commit into from
Apr 25, 2025

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Apr 25, 2025

This PR contains the following updates:

Package Update Change
StyraInc/regal minor v0.32.0 -> v0.33.1

Release Notes

StyraInc/regal (StyraInc/regal)

v0.33.1

Compare Source

This release adds 4 new linter rules to Regal, alongside significant performance improvements and several bug fixes.

New Rule: in-wildcard-key

Using a wildcard variable (_) for the key in the key-value form of iteration (some _, value in collection) is never needed, and can be replaced by the simple some value in … form . This rule flags cases where the key iteration is redundant. (Read more)

package policy

allow if {

##### Avoid: key iteration ('_') is redundant if only 'user' is used
    some _, user in input.users

##### do something with each user
}

allow if {

##### Prefer: clearer intent when only iterating values
    some user in input.users

##### do something with each user
}

PR #​1466

New Rule: confusing-alias

While import aliases can improve readability, aliasing an import reference that is also imported without an alias is confusing, as both names point to the same resource. This rule catches such cases. (Read more)

package policy

##### Avoid: both 'users' and 'employees' point to data.resources.users
import data.resources.users
import data.resources.users as employees

##### Prefer: a single import for any given resource
##### import data.resources.users

PR #​1470

New Rule: mixed-iteration

Rego supports different styles of collection iteration. While "reference style" iteration (collection[_]) can be concise for deeply nested structures, mixing it with the some .. in style within a single iteration expression makes for code that’s more difficult to follow. This rule encourages consistency within a single iteration statement. (Read more)

package policy

allow if {

##### mixing 'some .. in' and reference iteration
    some resource in input.assets[_]

##### do something with resource
}

allow if {

##### using 'some .. in' iteration consistently
    some asset in input.assets
    some resource in asset

##### do something with resource
}

PR #​1475

New Rule: narrow-argument

This new rule analyzes function arguments to suggest narrowing them down to the minimal value the function depends on. This can improve clarity and reusability. The rule considers incrementally defined functions across all their definitions. This is a powerful but opinionated rule and is thus in the custom category and is not on by default. See the documentation for how to enable it if you’re curious to try it out! (Read more)

package policy

##### Avoid: the function only uses the 'email' property of the 'user' object
valid_user(user) if endswith(user.email, "acmecorp.com")
valid_user(user) if endswith(user.email, "acmecorp.org")

##### Prefer: narrowing the argument to only what the function needs
valid_email(email) if endswith(email, "acmecorp.com")
valid_email(email) if endswith(email, "acmecorp.org")

PR #​1488

Performance Improvements

Several improvements have been made to reduce memory allocations and improve overall linting performance. Numbers below refer to Regal’s benchmark for linting its own policies.

  • Optimized config loading and parsing, saving around 2.7 million allocations (#​1491).
  • Reduced allocations by approximately 2 million (#​1494).
  • Improved the performance of the use-strings-count rule, saving almost 1 million allocations (#​1465).
  • Optimized reference comparisons and small iteration patterns, saving around 300k allocations (#​1472).
  • Included performance enhancements alongside an update to the external-reference rule to make it more configurable (#​1496).
OPA v1.3.0

Regal has been upgraded to use OPA v1.3.0. This brings several upstream improvements, including support for the new one-liner grouping in formatting (see OPA#6760). (#​1459)

Bug Fixes
  • Fixed a bug in the handling of Rego input from stdin. Thanks @​tokyowizard for the report! (#​1474)
  • Fixed a panic that could occur in FindConfigRoots when supplied with unexpected arguments. (#​1487)
Other Rule Updates
  • The external-reference rule can now be configured with a maximum number of allowed external references, instead of solely flagging all external uses within a function. If you previously had this rule disabled, you might want to try enabling it now, and possibly tweak its configuration to your liking. (#​1496)
  • The rule-length rule now has a separate setting (max-test-rule-length) with a higher default value (60 vs 30) for test rules, acknowledging that tests often include substantial data. (#​1476)
  • Updated documentation for the rule-named-if rule based on community feedback received via the page feedback form (please let us know if you see issues! & thanks for the report!) (#​1463)
Dependencies

This release also updates Regals dependencies as follows.

Go Mod:
GitHub Actions:
Changelog

Full Changelog: StyraInc/regal@v0.32.0...v0.33.1

v0.33.0

Compare Source

This release is the same tag as v0.33.1, please see that release for the release notes.

Another v0.33.1 was released to trigger the rebuilding of some assets that were deleted in a draft release.


Configuration

📅 Schedule: Branch creation - Between 12:00 AM and 03:59 AM, only on Monday ( * 0-3 * * 1 ) (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot requested a review from a team as a code owner April 25, 2025 14:57
@garethahealy garethahealy merged commit 692784a into main Apr 25, 2025
12 checks passed
@renovate renovate bot deleted the renovate/styrainc-regal-0.x branch April 25, 2025 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant