Skip to content

Conversation

@Piskoo
Copy link
Collaborator

@Piskoo Piskoo commented Jul 18, 2025

This PR adds a default configuration for the Regal linter and introduces a flag to specify custom configuration.

Usage

chainloop policy develop lint --policy policy.yaml --regal config.cfg 

If no config was passed or config is malformed then default config is used as fallback.

Default config:

rules:
  idiomatic:
    directory-package-mismatch:
      level: ignore
    no-defined-entrypoint:
      level: warning
  style:
    todo-comment:
      level: ignore
    line-length:
      level: ignore
    rule-length:
      level: ignore

Part of #1108

Piskoo added 13 commits July 14, 2025 13:23
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
… replicated code

Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
@Piskoo Piskoo marked this pull request as ready for review July 18, 2025 13:41
@migmartri
Copy link
Member

How does regal work today in terms of config, does it auto-detect it? Maybe we can do the same? i.e if it finds a regal config file uses it? Just thinking

@jiparis
Copy link
Member

jiparis commented Jul 18, 2025

How does regal work today in terms of config, does it auto-detect it? Maybe we can do the same? i.e if it finds a regal config file uses it? Just thinking

If no file provided via command line, it tries to find a default configuration in .regal and in parent directories. But everything happens in the CLI/cobra setup.
https://docs.styra.com/regal/configuration

I think having the command line option is enough for us, but at some point we could provide the same experience. Not important at all.

@javirln
Copy link
Member

javirln commented Jul 21, 2025

Also agree the default configuration + flag to custom config is more than enough. I doubt we will change it often. Maybe I would rename the flag from regal to regal-config to make it explicit, but not a big deal.

Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
@Piskoo
Copy link
Collaborator Author

Piskoo commented Jul 21, 2025

Also agree the default configuration + flag to custom config is more than enough. I doubt we will change it often. Maybe I would rename the flag from regal to regal-config to make it explicit, but not a big deal.

Renamed the flag to regal-config

How does regal work today in terms of config, does it auto-detect it? Maybe we can do the same? i.e if it finds a regal config file uses it? Just thinking

If no file provided via command line, it tries to find a default configuration in .regal and in parent directories. But everything happens in the CLI/cobra setup. https://docs.styra.com/regal/configuration

I think having the command line option is enough for us, but at some point we could provide the same experience. Not important at all.

I could add this as another config lookup step for example if no config file was provided implicitly via regal-config flag, then search that attempts to find either the .regal directory or .regal.yaml would be performed, any only then if no cfg file was discovered we would fallback to the default config.

@@ -0,0 +1,14 @@
# Default config
rules:
Copy link
Member

Choose a reason for hiding this comment

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

I'd keep the credits for the original author, i.e spacelift I think?

Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
@Piskoo Piskoo merged commit 8eb3774 into chainloop-dev:main Jul 22, 2025
13 checks passed
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.

4 participants