Skip to content

Add compact JSON output for scancode - #5365

Open
AyanSinhaMahapatra wants to merge 5 commits into
developfrom
compact-scan-output
Open

AyanSinhaMahapatra wants to merge 5 commits into
developfrom
compact-scan-output

Conversation

@AyanSinhaMahapatra

@AyanSinhaMahapatra AyanSinhaMahapatra commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

This PR adds a new compact JSON output to minimize scan results filesize by ensuring this option skips duplicate and non-essential attributes. This implements the following for making the scan results compact:

  1. remove all duplicated/inline data present in multiple levels (example: removes license detection matches in resource-levels and only keeps top-level unique license detections which makes sure data for a detection is only present once)
  2. skip all duplicated codebase/resource attributes (example: keep only one license expression, instead of both scancode/spdx expressions)
  3. skip all large/non-essential codebase/resource attributes (example: remove description, license text, diagnostics and other fields, which can be fetched from the original file too if required)
  4. remove all empty attributes recursively (keep only the key/value pairs which are non-empty)

Fixes #4555

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • Tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR
    Run tests locally to check for errors.
  • Commits are in uniquely-named feature branch and has no merge conflicts 📁
  • Updated documentation pages (if applicable)
  • Updated CHANGELOG.rst (if applicable)

As a preperation step to adding a compact JSON output.

Signed-off-by: Ayan Sinha Mahapatra <asmahapatra@aboutcode.org>
Reference: #4555
Signed-off-by: Ayan Sinha Mahapatra <asmahapatra@aboutcode.org>
@JonoYang

Copy link
Copy Markdown
Member

Signed-off-by: Ayan Sinha Mahapatra <asmahapatra@aboutcode.org>
@AyanSinhaMahapatra

Copy link
Copy Markdown
Member Author

@JonoYang this was quite a headscratcher of a failure, I thought first this was due to old entrypoints being present but actually what was happening is an old version of scancode-toolkit getting installed from pip here and this having different entrypoints, could not load the plugins properly anymore.

This should be fixed now.

@AyanSinhaMahapatra
AyanSinhaMahapatra force-pushed the compact-scan-output branch 2 times, most recently from 01de342 to 85e83fc Compare October 27, 2026 21:29
Signed-off-by: Ayan Sinha Mahapatra <asmahapatra@aboutcode.org>

This branch has not been deployed

No deployments
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.

swh-cc: Create compact scan output

2 participants