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

Feature/support color op for scoring #350

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

viveksahu26
Copy link
Collaborator

@viveksahu26 viveksahu26 commented Nov 9, 2024

closes: #302

This PR makes score command output(detailed) colourful.

Test it:

$ `sbomqs compliance --color  --bsi  samples/sbomqs-spdx-sbtool.json`

$ `sbomqs compliance --color  --oct  samples/sbomqs-spdx-sbtool.json`

$ `sbomqs compliance --color  --ntia  samples/sbomqs-spdx-sbtool.json

or

$ `sbomqs compliance --color=true  --bsi  samples/sbomqs-spdx-sbtool.json`

$ `sbomqs compliance --color=true  --oct  samples/sbomqs-spdx-sbtool.json`

$ `sbomqs compliance --color=true  --ntia  samples/sbomqs-spdx-sbtool.json

See below:

➜ go run main.go score -h                                
comprehensive quality score for your sbom

Usage:
  sbomqs score [flags]

Examples:
 sbomqs score [--category <category>] [--feature <feature>]  [--basic|--json]  <SBOM file>

  # Get a score against a SBOM in a table output
  sbomqs score samples/sbomqs-spdx-syft.json

  # Get a score against a SBOM in a basic output
  sbomqs score --basic samples/sbomqs-spdx-syft.json

  # Get a score against a SBOM in a JSON output
  sbomqs score --json samples/sbomqs-spdx-syft.json
 
  # Get a score for a 'NTIA-minimum-elements' category against a SBOM in a table output
  sbomqs score --category NTIA-minimum-elements samples/sbomqs-spdx-syft.json

  # Get a score for a 'NTIA-minimum-elements' category and 'sbom_authors' feature against a SBOM in a table output
  sbomqs score --category NTIA-minimum-elements --feature sbom_authors samples/sbomqs-spdx-syft.json

  # Get  a score for multiple features
  sbomqs score --feature comp_with_name,comp_with_uniq_ids,sbom_authors,sbom_creation_timestamp  samples/sbomqs-spdx-syft.json 

  # Get a score for multiple categories
  sbomqs score --category NTIA-minimum-elements,Structural,Semantic,Sharing   samples/sbomqs-spdx-syft.json


Flags:
  -b, --basic               results in single line format
  -c, --category string     filter by category (e.g. 'NTIA-minimum-elements', 'Quality', 'Semantic', 'Sharing', 'Structural')
  -l, --color               output in colorful
      --configpath string   scoring based on config path
  -D, --debug               enable debug logging
  -d, --detailed            results in table format, default
  -f, --feature string      filter by feature (e.g. 'sbom_authors',  'comp_with_name', 'sbom_creation_timestamp') 
  -h, --help                help for score
  -j, --json                results in json

$ sbomqs score --color samples/photon.spdx.json

image

riteshnoronha
riteshnoronha previously approved these changes Nov 9, 2024
@viveksahu26
Copy link
Collaborator Author

viveksahu26 commented Nov 11, 2024

For now you can merge this. Will open a separate new PR for all compliance(bsi, oct, ntia) supporting color o/p.
I have added the support for color for all compliances like bsi, ntia, oct, etc. For bsi-v2, will add later, once this PR gets merged.

Signed-off-by: Vivek Kumar Sahu <[email protected]>

add color flag

Signed-off-by: Vivek Kumar Sahu <[email protected]>

fix errcheck golangci issue

Signed-off-by: Vivek Kumar Sahu <[email protected]>
@viveksahu26 viveksahu26 force-pushed the feature/support_color_op_for_scoring branch from b9d14a4 to 1afa6ac Compare December 1, 2024 08:47
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.

[CLI] Enhance sbomqs score command output with color-coded scores
2 participants