Skip to content
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

Update dependency StyraInc/regal to v0.26.2 #325

Merged
merged 2 commits into from
Sep 11, 2024

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Sep 9, 2024

This PR contains the following updates:

Package Update Change
StyraInc/regal minor v0.25.0 -> v0.26.2

Release Notes

StyraInc/regal (StyraInc/regal)

v0.26.2

Compare Source

This releases contains a bug fixes for an issue introduced in v0.26.0 as well as a number of other minor improvements.

Notable Bug fixes:

  • #​1087 fixes an issue in the marshalling of ASTs using RoAST
  • #​1056 Makes a change to no longer suggest built in functions for default rules
  • #​1065 fixes an issue where git was required even when fixing in dry run mode
  • #​1069 fixes an edge case in use-some-for-output-vars
  • #​1078, #​1080, #​1083, #​1085 fix issues relating to file rename updates from the client
  • #​1093 addresses an issue where the fix command produced the incorrect result due to relative paths
  • #​1081 ensures that .manifest files are correctly detected as 'roots' when fixing

New features:

  • #​1059 updates the language server to suggest boolean values at relevant times
  • #​1088 adds a new feature for rule authors to use the files from their project as input for evaluation

Changelog

v0.26.1

Compare Source

This releases contains a bug fix for an issue introduced in v0.26.0. The bug was caused by a change the required data to complete a formatting Rego 'fix'.

Changelog

v0.26.0

Compare Source

0.26.0

v0.26.0 brings 2 new linter rules to Regal, a debugger API backend, and noticeably faster linting.

Regal v0.26.0 is likely the first consumer of the new debugger API that landed in OPA v0.68.0 just last week — and in turn uses this to expose a first ever Debug Adapter Protocol (DAP) backend for Rego! Next release of the OPA VS Code extension will leverage Regal to provide developers a first-class debugging experience for Rego. Stay tuned!

Thanks to @​johanfylling for tirelessly working to make this happen — in both OPA, Regal, and the OPA VS Code extension.

Rules

New rule: directory-package-mismatch

Category: idiomatic

The directory-package-mismatch rule is a first of its kind in Regal, as it reports issues in project structure rather than in code. This rule codifies an old best practice in Rego projects: the package name (path) should be mirrored in the directory structure a policy resides in. Put simply, a policy declaring package rbac.user.roles should be placed in a rbac/user/roles directory.

The directory-package-mismatch rule not only helps enforce this convention, but provides both CLI (regal fix) and editor support for fixing these issues automatically.

Note: When used on an existing project, this rule will likely result in a lot of violations being reported. While regal fix can remediate that in a matter of seconds (by moving policy files according to their package paths), make sure to commit or stash any existing changes before running it, and then review the result. Read the docs for details!

For more information, see the docs on directory-package-mismatch.

New Rule: sprintf-arguments-mismatch

Category: bugs

The new sprintf-arguments-mismatch rule checks that the formatting directives (%s, %d, etc) in a sprintf call match the supplied number arguments.

Wrong

msg := sprintf("number of issues (%d) must not be higher than %d", [count(issues)])

Correct

msg := sprintf("number of issues (%d) must not be higher than %d", [count(issues), 10])

For more information, see the docs on sprintf-arguments-mismatch.

Debug Adapter Protocol Backend

This release add support in Regal for the Debug Adapter Protocol. Similar to the language server protocol, this new functionality will support users of compatible clients to step-by-step debug their Rego projects in an interactive manner. Client implementation in the VS Code OPA extension soon to follow!

Language Server: auto-completion based on input.json

Both the OPA VS Code extension, and Regal supports placing an input.json file in the workspace and automatically have it used as input for evaluation. If found, Regal will now additionally use this to provide completion suggestions on input based on the fields found in that file. If you haven't made it a habit yet to keep an input.json file in your workspace, now is a good time to start!

New RoAST library for custom AST serialization

Regal now uses a new, custom and optimized AST format to improve the performance of Regal. The new library is integrated into Regal in this release and represents around a 50% reduction in AST JSON size, and a 25% performance improvement in linting over the previous implementation.

For more information, see the docs in the roast project repo.

Special thanks to our contributors from the community!

Changelog


Configuration

📅 Schedule: Branch creation - "before 4am on Monday" (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 September 9, 2024 00:20
@renovate renovate bot force-pushed the renovate/styrainc-regal-0.x branch from 9f729d1 to a1d9ac9 Compare September 9, 2024 13:44
@garethahealy
Copy link
Contributor

@anderseknert i think we might have hit a bug with regal.

This PR bumps to the latest version but we are getting a random AST error:

error(s) encountered while linting: failed to lint using Rego rules: error encountered in rule evaluation failed preparing AST: JSON rountrip failed for module: ReadMapCB: object not ended with }, error found in #10 byte of ...|uota"]}]}"skipConstr|..., bigger context ...|ps":[""],"kinds":["Namespace","ResourceQuota"]}]}"skipConstraint":true}}],"rules":[{"location":"24:1|...

I think the key bit is skipConstr. If I remove any policy that contains skipConstraint which is a konstraint flag:

The issue goes away. I have a number of polices that contain that flag, so not something quick and easy to remove.

@anderseknert
Copy link
Contributor

Thanks for reporting that @garethahealy! We're working on patching up some other issues for a v0.26.2 release, and I'll see if we can get a fix for this included too.

@anderseknert
Copy link
Contributor

Issue identified and fixed, and will be part of v0.26.2 released tomorrow. Thanks again for reporting this @garethahealy 👍

@renovate renovate bot force-pushed the renovate/styrainc-regal-0.x branch from 430bd37 to bfb5d73 Compare September 11, 2024 09:40
@renovate renovate bot changed the title Update dependency StyraInc/regal to v0.26.1 Update dependency StyraInc/regal to v0.26.2 Sep 11, 2024
@garethahealy garethahealy merged commit f0b18b9 into main Sep 11, 2024
14 checks passed
@renovate renovate bot deleted the renovate/styrainc-regal-0.x branch September 11, 2024 09:55
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.

2 participants