Skip to content

Conversation

pepper-jk
Copy link
Contributor

@pepper-jk pepper-jk commented Jul 14, 2025

Image

Description

The license references table in the HTML output does not get created with the current version of scancode (32.3.2).
The table was previously (31.2.6) called licenses and was located at the very bottom the static HTML output, see image above.
It summarized all licenses found in the scanned project in one table together with their metadata, such as URL to license text and category.

Evidence suggests that this is broken ever since 32.0.0, specifically PR #3275, where the source of the license references table was changed. This PR basically reverts the changes from 49e7d89, which case the described bug, and adjusts the older code to fit the current HTML template:

The new template expects a sorted list of license objects, therefore the licenses dictionary gets converted. None entries get discarded. Finally the empty license_references get overridden with the finished list of collected licenses.

Fixes #4101. Please refer to the issue for more information on the bug.

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)

Signed-off-by: Jens Keim [email protected]

@pepper-jk
Copy link
Contributor Author

pepper-jk commented Jul 14, 2025

Everything succeeds except the macOS tests, which I assume fail for unrelated reasons.

I also added myself to Authors and added the fix to the changelog as per the PR template tasks.
But let me know if I should skip the Authors step, since this is such a small contribution.

@pepper-jk pepper-jk marked this pull request as ready for review July 14, 2025 11:53
@pepper-jk
Copy link
Contributor Author

Hi @AyanSinhaMahapatra, could you please review my changes and let me know if they are OK?

From reading your code in 49e7d89, I had the hunch you were about to change the underlying data sources, but did not get around to finishing it, at least not for the license ref table in the HTML output. (more context in the issue)

I thought, until your refactoring is finished maybe this PR could act as a temporary fix, so users can utilize the html reports again?

Copy link
Member

@AyanSinhaMahapatra AyanSinhaMahapatra left a comment

Choose a reason for hiding this comment

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

@pepper-jk thanks for the PR.

The license references are available with the --license-references CLI option enabled, this was added allright.

Please see my comments and also #4101 (comment), could you also add a small documentation improvement for this?

@pepper-jk pepper-jk marked this pull request as draft July 23, 2025 11:20
@pepper-jk
Copy link
Contributor Author

I submitted the requested changes, but I'd like to test the behavior before we merge, so I set the PR back to a draft.

I will test the behavior shortly.

@pepper-jk pepper-jk force-pushed the html-license-ref-table-fix branch from cd91e29 to a63ae00 Compare July 23, 2025 11:26
@pepper-jk
Copy link
Contributor Author

I finished testing and can confirm that with these changes the license reference table gets printed in html outputs, if the --license-references flag was set during scan or html conversion or not.

I will now work on the documentation and potentially squash the changes inside output_html.py into one commit.

The `--license-references` cli argument enables collection and storge
of license reference data in output files. So as long as it was present
as a Post-Scan option the `license_references` should not be empty.
In such cases, the license reference table shall be filled with the
already stored data.

If however the `license_references` list is empty, the licenses should
be collected from the `license_db` as a fall back, similar to the legacy
license collection pre 49e7d89.

Fixes aboutcode-org#4101.

Signed-off-by: Jens Keim <[email protected]>
`--license-references` is recommended, but mention the new fallback.

Signed-off-by: Jens Keim <[email protected]>
@pepper-jk pepper-jk force-pushed the html-license-ref-table-fix branch from 3089c7b to 1842cad Compare July 23, 2025 15:11
@pepper-jk pepper-jk changed the title OutputHTML: Fix License Reference Table content feat(OutputHTML): Always print license references table Jul 23, 2025
@pepper-jk pepper-jk marked this pull request as ready for review July 23, 2025 15:13
@pepper-jk
Copy link
Contributor Author

I added a note in the documentation, updated the changelog and the commit messages to the new changes, and squashed the commits. Should be ready now.

Copy link
Member

@AyanSinhaMahapatra AyanSinhaMahapatra left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks++ @pepper-jk Merging!

@AyanSinhaMahapatra AyanSinhaMahapatra merged commit e411b8b into aboutcode-org:develop Jul 24, 2025
36 checks passed
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.

License References table missing from HTML output

2 participants