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

✨ Add a --details-format Option to produce JSON-details #2910

Closed
wants to merge 6 commits into from

Conversation

laurentsimon
Copy link
Contributor

This PR:

Add a `--details-format` Option to produce JSON-details

Signed-off-by: laurentsimon <laurentsimon@google.com>
Signed-off-by: laurentsimon <laurentsimon@google.com>
Signed-off-by: laurentsimon <laurentsimon@google.com>
DetailsFormatString = "string"
// DetailsFormatFindings specifies that the details will be reported as "structured" findings
// that are more suited for automated parsing.
DetailsFormatFinding = "finding"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm looking for feedback of what to name this details' format.

Signed-off-by: laurentsimon <laurentsimon@google.com>
Signed-off-by: laurentsimon <laurentsimon@google.com>
Signed-off-by: laurentsimon <laurentsimon@google.com>
@laurentsimon laurentsimon temporarily deployed to integration-test April 25, 2023 21:09 — with GitHub Actions Inactive
@codecov
Copy link

codecov bot commented Apr 25, 2023

Codecov Report

Merging #2910 (f092e10) into main (e982f9f) will increase coverage by 0.00%.
The diff coverage is 53.84%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2910   +/-   ##
=======================================
  Coverage   52.42%   52.43%           
=======================================
  Files         158      158           
  Lines       12108    12146   +38     
=======================================
+ Hits         6348     6369   +21     
- Misses       5390     5407   +17     
  Partials      370      370           

Copy link
Contributor

@spencerschrock spencerschrock left a comment

Choose a reason for hiding this comment

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

I'm a bit confused at the purpose of this flag.

Do you imagine the need for --format json users to use the finding detail format as well? Or for --format structured-json users to use the string detail format?

I don't really see a difference in output when running these commands:

SCORECARD_EXPERIMENTAL=1 go run main.go --repo ossf/scorecard --format structured-json --details-format string --show-details

SCORECARD_EXPERIMENTAL=1 go run main.go --repo ossf/scorecard --format structured-json --details-format finding --show-details

@@ -116,7 +116,7 @@ func FormatResults(
// TODO: support config files and update checker.MaxResultScore.
err = results.AsSARIF(opts.ShowDetails, log.ParseLevel(opts.LogLevel), os.Stdout, doc, policy, opts)
case options.FormatJSON:
err = results.AsJSON2(opts.ShowDetails, log.ParseLevel(opts.LogLevel), doc, os.Stdout)
err = results.AsJSON3(opts, log.ParseLevel(opts.LogLevel), doc, os.Stdout)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be hesitant with this change. I thought this was enabling the JSONScorecardResultV3 for the --format json users.

This is misleading in my opinion.

@laurentsimon
Copy link
Contributor Author

Closing this PR. Based on @spencerschrock 's comment, I don't think it's needed. Re-using --format should be less confusing.

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.

None yet

2 participants