Skip to content

Commit cdbf131

Browse files
committed
Update help text and comments
Signed-off-by: Jono Yang <jyang@nexb.com>
1 parent 64f6d48 commit cdbf131

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/scancode/plugin_summary.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ def logger_debug(*args):
6464
@post_scan_impl
6565
class OriginSummary(PostScanPlugin):
6666
"""
67-
Rolls up copyright and license results to the directory level if a copyright or license
68-
is detected in 75% or more of total files in a directory
67+
Summarize copyright holders and license expressions to the directory level if a copyright holder
68+
or license expression is detected in 75% or more of total files in a directory
6969
"""
7070
resource_attributes = dict(
7171
origin_summary=attr.ib(default=attr.Factory(OrderedDict)),
@@ -77,8 +77,11 @@ class OriginSummary(PostScanPlugin):
7777
options = [
7878
CommandLineOption(('--origin-summary',),
7979
is_flag=True, default=False,
80-
help='Origin summary',
81-
help_group=POST_SCAN_GROUP)
80+
help='Summarize copyright holders and license expressions to the directory level '
81+
'if a copyright holder or license expression is detected in 75% or more of '
82+
'total files in a directory',
83+
help_group=POST_SCAN_GROUP
84+
)
8285
]
8386

8487
def is_enabled(self, origin_summary, **kwargs):
@@ -106,7 +109,7 @@ def process_codebase(self, codebase, **kwargs):
106109
for child in children:
107110
if child.is_file:
108111
license_expression = combine_expressions(child.license_expressions)
109-
holders = tuple(h['value'] for h in child.holders if h['value'])
112+
holders = tuple(h['value'] for h in child.holders)
110113
if not license_expression or not holders:
111114
continue
112115
origin = holders, license_expression
@@ -145,7 +148,7 @@ def process_codebase(self, codebase, **kwargs):
145148

146149
def is_majority(count, files_count):
147150
"""
148-
Return True is this resource is a whatever directory with at least over 75% of whatever at full depth.
151+
Return True if `count` is 75% or more of `files_count`
149152
"""
150153
# TODO: Increase this and test with real codebases
151154
return count / files_count >= 0.75

tests/scancode/data/help/help.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ Options:
9292
contain over 90% of source files as children and
9393
descendants. Count the number of source files in a
9494
directory as a new source_file_counts attribute
95+
--origin-summary Summarize copyright holders and license expressions
96+
to the directory level if a copyright holder or
97+
license expression is detected in 75% or more of
98+
total files in a directory
9599
--summary Summarize license, copyright and other scans at the
96100
codebase level.
97101
--summary-by-facet Summarize license, copyright and other scans and

0 commit comments

Comments
 (0)