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

Add --multiple option to the CLI #95

Merged
merged 1 commit into from
Oct 21, 2024
Merged

Conversation

markus456
Copy link
Contributor

The --multiple option enables uses ScanMode::TopDown to detect multiple licenses in the same file. The confidence score is still zero for the whole file but having a list of licenses in the file is still useful. An improvement would be to use the individual confidence scores in the reported total score.

Added a test case that uses the license from python-zeep that issue #40 is about where the file has one MIT and two BSD-3-Clause licenses in it.

Issue #, if available: #40

Description of changes:

  • Added the -m, --multiple option for enabling ScanMode::TopDown

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

The --multiple option enables uses ScanMode::TopDown to detect multiple
licenses in the same file. The confidence score is still zero for the
whole file but having a list of licenses in the file is still useful. An
improvement would be to use the individual confidence scores in the
reported total score.

Added a test case that uses the license from python-zeep that issue jpeddicord#40
is about where the file has one MIT and two BSD-3-Clause licenses in it.
@markus456
Copy link
Contributor Author

Testing this with something more complex like the MariaDB server third-party license file shows that it detects the licenses pretty well. Looking at the line number output, it can be seen that chunks of the file are not detected which should be a helpful starting point for manually parsing the license file.

License: Unknown
Score: 0.000
Containing:
  License: BSD-3-Clause (original text)
  Score: 0.919
  Lines: 10 - 36
  License: GPL-2.0-only (license header)
  Score: 0.923
  Lines: 99 - 112
  Aliases: GPL-2.0-or-later
  License: Zlib (original text)
  Score: 1.000
  Lines: 127 - 144
  License: BSD-3-Clause (original text)
  Score: 0.965
  Lines: 166 - 195
  License: ISC (original text)
  Score: 0.932
  Lines: 212 - 226
  License: BSD-3-Clause (original text)
  Score: 0.936
  Lines: 231 - 257
  License: GPL-2.0-only (original text)
  Score: 0.996
  Lines: 484 - 788
  Aliases: GPL-2.0-or-later
  License: Unicode-TOU (original text)
  Score: 0.895
  Lines: 956 - 1082
  License: Unicode-DFS-2016 (original text)
  Score: 0.881
  Lines: 1087 - 1131
  License: Zlib (original text)
  Score: 1.000
  Lines: 1141 - 1157
  License: GPL-2.0-only (original text)
  Score: 0.993
  Lines: 1295 - 1628
  Aliases: GPL-2.0-or-later
  License: BSD-3-Clause (original text)
  Score: 0.919
  Lines: 1642 - 1664
  License: BSD-3-Clause (original text)
  Score: 0.931
  Lines: 1686 - 1715
  License: BSD-3-Clause (original text)
  Score: 0.912
  Lines: 1719 - 1741

@jpeddicord
Copy link
Owner

Thanks for the change, and apologies for the delay! Going to work on releasing this and other PRs tomorrow.

@jpeddicord jpeddicord merged commit 4d1a187 into jpeddicord:master Oct 21, 2024
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.

2 participants