Skip to content

Commit

Permalink
Add tests for new license clarity scoring #2861
Browse files Browse the repository at this point in the history
Signed-off-by: Jono Yang <jyang@nexb.com>
  • Loading branch information
JonoYang committed Feb 22, 2022
1 parent 56d91ad commit d8bb5dc
Show file tree
Hide file tree
Showing 20 changed files with 1,775 additions and 35 deletions.
5 changes: 5 additions & 0 deletions src/summarycode/score2.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ def compute_license_score(codebase):


def check_ambiguous_license_expression(declared_license_expressions):
if not declared_license_expressions:
return False

unique_declared_license_expressions = set(declared_license_expressions)
if len(unique_declared_license_expressions) == 1:
return False
Expand Down Expand Up @@ -331,6 +334,8 @@ def check_declared_licenses(declared_licenses):
If so, return True. Otherwise, return False.
"""
if not declared_licenses:
return False
return all(
is_good_license(declared_license)
for declared_license
Expand Down
74 changes: 39 additions & 35 deletions tests/scancode/data/help/help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,41 +89,45 @@ Options:
<pattern>.

post-scan:
--consolidate Group resources by Packages or license and copyright
holder and return those groupings as a list of
consolidated packages and a list of consolidated
components. This requires the scan to have/be run
with the copyright, license, and package options
active
--filter-clues Filter redundant duplicated clues already contained
in detected license and copyright texts and notices.
--is-license-text Set the "is_license_text" flag to true for files that
contain mostly license texts and notices (e.g over
90% of the content).[DEPRECATED] this is now built-in
in the --license-text option with a
"percentage_of_license_text" attribute.
--license-clarity-score Compute a summary license clarity score at the
codebase level.
--license-policy FILE Load a License Policy file and apply it to the scan
at the Resource level.
--licenses-reference Include a reference of all the licenses referenced in
this scan with the data details and full texts.
--mark-source Set the "is_source" to true for directories that
contain over 90% of source files as children and
descendants. Count the number of source files in a
directory as a new source_file_counts attribute
--summary Summarize license, copyright and other scans at the
codebase level.
--summary-by-facet Summarize license, copyright and other scans and
group the results by facet.
--summary-key-files Summarize license, copyright and other scans for key,
top-level files. Key files are top-level codebase
files such as COPYING, README and package manifests
as reported by the --classify option "is_legal",
"is_readme", "is_manifest" and "is_top_level" flags.
--summary-with-details Summarize license, copyright and other scans at the
codebase level, keeping intermediate details at the
file and directory level.
--consolidate Group resources by Packages or license and
copyright holder and return those groupings as a
list of consolidated packages and a list of
consolidated components. This requires the scan to
have/be run with the copyright, license, and
package options active
--filter-clues Filter redundant duplicated clues already contained
in detected license and copyright texts and
notices.
--is-license-text Set the "is_license_text" flag to true for files
that contain mostly license texts and notices (e.g
over 90% of the content).[DEPRECATED] this is now
built-in in the --license-text option with a
"percentage_of_license_text" attribute.
--license-clarity-score Compute a summary license clarity score at the
codebase level.
--license-clarity-score-2 Compute a summary license clarity score at the
codebase level.
--license-policy FILE Load a License Policy file and apply it to the scan
at the Resource level.
--licenses-reference Include a reference of all the licenses referenced
in this scan with the data details and full texts.
--mark-source Set the "is_source" to true for directories that
contain over 90% of source files as children and
descendants. Count the number of source files in a
directory as a new source_file_counts attribute
--summary Summarize license, copyright and other scans at the
codebase level.
--summary-by-facet Summarize license, copyright and other scans and
group the results by facet.
--summary-key-files Summarize license, copyright and other scans for
key, top-level files. Key files are top-level
codebase files such as COPYING, README and package
manifests as reported by the --classify option
"is_legal", "is_readme", "is_manifest" and
"is_top_level" flags.
--summary-with-details Summarize license, copyright and other scans at the
codebase level, keeping intermediate details at the
file and directory level.

core:
--timeout <secs> Stop an unfinished file scan after a timeout in
Expand Down
Loading

0 comments on commit d8bb5dc

Please sign in to comment.