Skip to content

feat(policy-devel): enhance lint error output#2385

Merged
Piskoo merged 3 commits intochainloop-dev:mainfrom
Piskoo:feat-enhance-lint-output
Aug 22, 2025
Merged

feat(policy-devel): enhance lint error output#2385
Piskoo merged 3 commits intochainloop-dev:mainfrom
Piskoo:feat-enhance-lint-output

Conversation

@Piskoo
Copy link
Collaborator

@Piskoo Piskoo commented Aug 21, 2025

This PR add additional information to lint errors.
Lint errors now include:

  • rule id
  • documentation resources

Before

<file>:<line>: <errorMsg>

After

<file>:<line>: [<ruleName>] <errorMsg> - <docLinks>

Example

+---+---------------------------------------------------------------------------------------------------------------------------------------+
| # | ISSUE                                                                                                                                 |
+---+---------------------------------------------------------------------------------------------------------------------------------------+
| 1 | policy-script.rego:129: [help_text]: Call to print or trace function - https://docs.styra.com/regal/rules/testing/print-or-trace-call |
| 2 | testo2.rego:50: [not_fine]: Prefer `if` over boolean assignment - https://docs.styra.com/regal/rules/idiomatic/boolean-assignment     |
| 3 | testo2.rego:46: [fine]: Avoid double negatives - https://docs.styra.com/regal/rules/style/double-negative                             |
| 4 | testo2.rego:41: [violations]: Call to print or trace function - https://docs.styra.com/regal/rules/testing/print-or-trace-call        |
+---+---------------------------------------------------------------------------------------------------------------------------------------+

Closes #2377

Piskoo added 3 commits August 21, 2025 15:59
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 August 21, 2025 14:25
@Piskoo Piskoo requested review from javirln and migmartri August 21, 2025 14:25
@migmartri
Copy link
Member

thanks, can you put an example?

is the link added on each rule? overall?

@Piskoo
Copy link
Collaborator Author

Piskoo commented Aug 22, 2025

Updated with example.
Link is added to regal errors (opa doesn't provide them) it's attached to each lint error.

Copy link
Member

@migmartri migmartri left a comment

Choose a reason for hiding this comment

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

nice

@Piskoo Piskoo merged commit 673e5cf into chainloop-dev:main Aug 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.

Enhance policy devel lint error output with rule ids and documentation links

2 participants