Fail with error when --profile used without JSON format#1918
Merged
anderseknert merged 2 commits intoopen-policy-agent:mainfrom Mar 29, 2026
Merged
Fail with error when --profile used without JSON format#1918anderseknert merged 2 commits intoopen-policy-agent:mainfrom
anderseknert merged 2 commits intoopen-policy-agent:mainfrom
Conversation
srenatus
approved these changes
Mar 25, 2026
Contributor
srenatus
left a comment
There was a problem hiding this comment.
You needed Claude for this? 😮
Check DCO, please. 👇
The --profile flag only works with --format json but previously produced no output silently when used with other formats. Now returns an error telling the user to use --format json. Fixes open-policy-agent#1542 Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Replace fmt.Errorf with errors.New (no format verbs) and add blank line above ctx assignment per wsl_v5 linter. Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
9f19c8c to
1baf26b
Compare
Contributor
Author
|
Fair point - this was definitely not Claude's finest hour. DCO and lint fixed in 1baf26b. |
Member
|
Thanks 👍 |
Contributor
Author
|
Thanks for the review and merge! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
--profileis used without--format json, regal now returns an error instead of silently producing no profiling data.Why this matters
Profiling only works with JSON output. Without this check, users get no feedback when they forget
--format json- the command succeeds but profiling data is missing. The error message tells them exactly what to do.Changes
cmd/lint.go: Added validation at the start oflint()that checksparams.profile && params.format != formatJSONand returns a descriptive error.Testing
go build ./...passesregal lint --profile .now returns the error message instead of silently dropping profiling dataFixes #1542
This contribution was developed with AI assistance (Claude Code).