Skip to content

Fix licenses in HTML output - #3275

Merged
AyanSinhaMahapatra merged 5 commits into
developfrom
fix-html-output
Apr 3, 2023
Merged

Fix licenses in HTML output#3275
AyanSinhaMahapatra merged 5 commits into
developfrom
fix-html-output

Conversation

@AyanSinhaMahapatra

@AyanSinhaMahapatra AyanSinhaMahapatra commented Feb 24, 2023

Copy link
Copy Markdown
Member

Fixes #3272

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 📁

Fix an issue in HTML output where no licenses were being shown,
now we also use license references here.

Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>

@pombredanne pombredanne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but we need a test

@jbohrmann

Copy link
Copy Markdown

Hi, license text is not included in HTML-output. As I am new to scancode I am not sure if this is expected behavior.
I run scancode under windows (py 3.9).
I call it this way (--license-text-diagnostics also does not change the output):
scancode.bat -cleui -n 2 --html output.html . --license-score 2 --license-text --license-text-diagnostics

@AyanSinhaMahapatra

Copy link
Copy Markdown
Member Author

@jbohrmann can you confirm that you used the checkout of this branch?

git clone https://github.com/nexB/scancode-toolkit.git
git checkout fix-html-output
./configure --dev
 scancode -clipeu --html output.html samples/

I seem to have licenses fine from this branch, attaching here the output.html file I generated using these commands above:
output.html

Also --html is a very basic output format, and does not have support for most of the advanced CLI options such as the one you have used:

  • --license-score
  • --license-text
  • --license-text-diagnostics
    Use --json or --yaml to use all the supported CLI options.

@jbohrmann

Copy link
Copy Markdown

@jbohrmann can you confirm that you used the checkout of this branch?

git clone https://github.com/nexB/scancode-toolkit.git
git checkout fix-html-output
./configure --dev
 scancode -clipeu --html output.html samples/

I seem to have licenses fine from this branch, attaching here the output.html file I generated using these commands above: output.html

Also --html is a very basic output format, and does not have support for most of the advanced CLI options such as the one you have used:

  • --license-score
  • --license-text
  • --license-text-diagnostics
    Use --json or --yaml to use all the supported CLI options.

Yes I can confirm.
Here is the info from my .VERSION file:

refs=refs/pull/3275/head, fix-html-output

I preferred HTML as I can pass the output easily to get legal advice.

Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
@AyanSinhaMahapatra

Copy link
Copy Markdown
Member Author

@jbohrmann what is your OS? also what is your installation process? Is it a git checkout or an app archive download? the .VERSION file looks like this https://github.com/nexB/scancode-toolkit/blob/develop/.VERSION when you are installing from a git checkout, what do you mean info from this file?
Can you do a git describe --tag for me and confirm that the output is v32.0.0rc2-2-g76795acd45 which is the last commit here?

See above the commit with added test for licenses in html, looks like they work fine now after these changes ^

@pombredanne

Copy link
Copy Markdown
Member

@AyanSinhaMahapatra @jbohrmann said it was Windows and Python 3.9 ;)

I run scancode under windows (py 3.9).

@pombredanne

Copy link
Copy Markdown
Member

but afaics, we do not include the license text be it the matched text or the reference text in the standard HTML output. Maybe we should. HTML is nicer than JSON for sure.

@AyanSinhaMahapatra

AyanSinhaMahapatra commented Mar 1, 2023

Copy link
Copy Markdown
Member Author

@pombredanne We could have support for license-text, summary, license-clarity-score and others too in the HTML output, I opened an issue for this: #3281.

@jbohrmann

Copy link
Copy Markdown

I downloaded the branch as zip over Github. OS is Windows 10.
Maybe it would be helpful to mention in the documentation that at the moment --html does not support all features.

@pombredanne

Copy link
Copy Markdown
Member

Maybe it would be helpful to mention in the documentation that at the moment --html does not support all features.

@jbohrmann you are right! Note that there are a few alternatives:

  • scancode.io provides a web ui to display the matched license text
  • it is possible otherwise to create a custom HTML template that would include the matched text

Comment thread src/formattedcode/templates/html/template.html
* Add named arguments and license_references as applicable
* Make --html-app a hidden argument
* Add homepage_url and tests for the same

Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>

@JonoYang JonoYang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. I've tested out the HTML output on a scan of the samples directory and the results look great. Thanks!

@AyanSinhaMahapatra

Copy link
Copy Markdown
Member Author

Thanks @JonoYang , merging!

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.

Docker run No license be detected!

4 participants