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

config: Search for .regal.yaml and use for roots #1357

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

charlieegan3
Copy link
Member

This updates the search for config to correctly look for .regal.yaml too. It also correctly uses .regal.yaml files for root determination.

$ cat foo.rego
───────┬────────────────────────────────────────────────────────────────────
       │ File: foo.rego
───────┼────────────────────────────────────────────────────────────────────
   1   │ package foo
   2   │
   3   │ allow if      true
───────┴────────────────────────────────────────────────────────────────────
$ cat .regal.yaml
───────┬────────────────────────────────────────────────────────────────────
       │ File: .regal.yaml
───────┼────────────────────────────────────────────────────────────────────
   1   │ rules:
   2   │   style:
   3   │     opa-fmt:
   4   │       level: ignore
───────┴────────────────────────────────────────────────────────────────────
$ ../regal fix --force foo.rego
1 fix applied:
In project root: /Users/charlieegan3/Code/regal/temp
foo.rego -> foo/foo.rego:
- directory-package-mismatch

Fixes #1342

This updates the search for config to correctly look for .regal.yaml
too. It also correctly uses .regal.yaml files for root determination.

```
$ cat foo.rego
───────┬────────────────────────────────────────────────────────────────────
       │ File: foo.rego
───────┼────────────────────────────────────────────────────────────────────
   1   │ package foo
   2   │
   3   │ allow if      true
───────┴────────────────────────────────────────────────────────────────────
$ cat .regal.yaml
───────┬────────────────────────────────────────────────────────────────────
       │ File: .regal.yaml
───────┼────────────────────────────────────────────────────────────────────
   1   │ rules:
   2   │   style:
   3   │     opa-fmt:
   4   │       level: ignore
───────┴────────────────────────────────────────────────────────────────────
$ ../regal fix --force foo.rego
1 fix applied:
In project root: /Users/charlieegan3/Code/regal/temp
foo.rego -> foo/foo.rego:
- directory-package-mismatch
```

Signed-off-by: Charlie Egan <[email protected]>
@grosser
Copy link

grosser commented Jan 22, 2025

confirmed it fixes the issue, thanks!

@charlieegan3
Copy link
Member Author

Thanks for confirming @grosser !

Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

@anderseknert anderseknert merged commit 2b25493 into StyraInc:main Jan 22, 2025
5 checks passed
@charlieegan3 charlieegan3 deleted the regal-yaml-adjustments branch January 22, 2025 18:09
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.

regal fix ignores config level: ignore
3 participants