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

Json output format support #45

Merged
merged 1 commit into from
Feb 21, 2023
Merged

Conversation

riteshnoronha
Copy link
Contributor

@riteshnoronha riteshnoronha commented Feb 18, 2023

I have added support for JSON output. This should help with post analysis of the results produced. The current implementation batches all the scores in memory, before writing it out. This works well with directorys with upto maybe 1000 files, once it exceeds those, this approach is not idle. We will need to think through a streaming option for directories with large number of file.s

sbomqs git:(38-feature-request-output-json) ./build/sbomqs score --category NTIA-minimum-elements --filepath samples/julia.spdx.json --reportFormat JSON
{
  "run_id": "65346347-119f-4de3-9762-5af8f717c5e0",
  "timestamp": "2023-02-17T09:47:07Z",
  "creation_info": {
    "name": "sbomqs",
    "version": "v0.0.6-1-geb3d2e6-dirty",
    "scoring_engine_version": "1"
  },
  "files": [
    {
      "file_name": "samples/julia.spdx.json",
      "spec": "spdx",
      "spec_version": "SPDX-2.2",
      "file_format": "json",
      "avg_score": 5.840336134453781,
      "scores": [
        {
          "category": "NTIA-minimum-elements",
          "feature": "Components have names",
          "score": 10,
          "max_score": 10,
          "description": "34/34 have names"
        },
        {
          "category": "NTIA-minimum-elements",
          "feature": "Doc has relationships",
          "score": 10,
          "max_score": 10,
          "description": "doc has 1 relationships "
        },
        {
          "category": "NTIA-minimum-elements",
          "feature": "Components have versions",
          "score": 0.29411764705882354,
          "max_score": 10,
          "description": "1/34 have versions"
        },
        {
          "category": "NTIA-minimum-elements",
          "feature": "Components have uniq ids",
          "score": 0,
          "max_score": 10,
          "description": "0/34 have unique ID's"
        },
        {
          "category": "NTIA-minimum-elements",
          "feature": "Doc has creation timestamp",
          "score": 10,
          "max_score": 10,
          "description": "doc has creation timestamp 2021-12-21T07:13:19Z"
        },
        {
          "category": "NTIA-minimum-elements",
          "feature": "Components have supplier names",
          "score": 0.5882352941176471,
          "max_score": 10,
          "description": "2/34 have supplier names"
        },
        {
          "category": "NTIA-minimum-elements",
          "feature": "Doc has authors",
          "score": 10,
          "max_score": 10,
          "description": "doc has 2 authors"
        }
      ]
    }
  ]
}

@riteshnoronha riteshnoronha linked an issue Feb 18, 2023 that may be closed by this pull request
@riteshnoronha riteshnoronha self-assigned this Feb 18, 2023
@riteshnoronha riteshnoronha changed the title WIP: initial json format Json output format support Feb 18, 2023
kchetans
kchetans previously approved these changes Feb 21, 2023
Copy link
Contributor

@kchetans kchetans left a comment

Choose a reason for hiding this comment

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

LGTM

@riteshnoronha riteshnoronha merged commit 5321232 into main Feb 21, 2023
@surendrapathak surendrapathak deleted the 38-feature-request-output-json branch November 8, 2023 04:05
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.

[Feature Request] Output JSON
2 participants