Skip to content

Commit fd3f1d7

Browse files
Restore the --unknown-licenses experimental CLI option
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
1 parent 5de2744 commit fd3f1d7

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

src/licensedcode/detection.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,6 +1212,7 @@ def detect_licenses(
12121212
deadline=sys.maxsize,
12131213
as_expression=False,
12141214
package_license=False,
1215+
unknown_licenses=False,
12151216
**kwargs
12161217
):
12171218
"""
@@ -1231,6 +1232,7 @@ def detect_licenses(
12311232
min_score=min_score,
12321233
deadline=deadline,
12331234
as_expression=as_expression,
1235+
unknown_licenses=unknown_licenses,
12341236
**kwargs,
12351237
)
12361238
elif query_string:
@@ -1239,6 +1241,7 @@ def detect_licenses(
12391241
min_score=min_score,
12401242
deadline=deadline,
12411243
as_expression=as_expression,
1244+
unknown_licenses=unknown_licenses,
12421245
**kwargs,
12431246
)
12441247
else:

src/licensedcode/plugin_license.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,14 @@ class LicenseScanner(ScanPlugin):
9999
help='Set the template URL used for the license reference URLs. '
100100
'Curly braces ({}) are replaced by the license key.',
101101
help_group=SCAN_OPTIONS_GROUP,
102-
)
102+
),
103+
PluggableCommandLineOption(
104+
('--unknown-licenses',),
105+
is_flag=True,
106+
required_options=['license'],
107+
help='[EXPERIMENTAL] Detect unknown licenses. ',
108+
help_group=SCAN_OPTIONS_GROUP,
109+
),
103110
]
104111

105112
def is_enabled(self, license, **kwargs): # NOQA
@@ -119,6 +126,7 @@ def get_scanner(
119126
license_text=False,
120127
license_text_diagnostics=False,
121128
license_url_template=SCANCODE_LICENSEDB_URL,
129+
unknown_licenses=False,
122130
**kwargs
123131
):
124132

@@ -128,6 +136,7 @@ def get_scanner(
128136
include_text=license_text,
129137
license_text_diagnostics=license_text_diagnostics,
130138
license_url_template=license_url_template,
139+
unknown_licenses=unknown_licenses,
131140
)
132141

133142
def process_codebase(self, codebase, **kwargs):

src/scancode/api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def get_licenses(
152152
include_text=False,
153153
license_text_diagnostics=False,
154154
deadline=sys.maxsize,
155+
unknown_licenses=False,
155156
**kwargs,
156157
):
157158
"""
@@ -189,6 +190,7 @@ def get_licenses(
189190
location=location,
190191
min_score=min_score,
191192
deadline=deadline,
193+
unknown_licenses=unknown_licenses,
192194
**kwargs,
193195
)
194196

tests/scancode/data/help/help.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Options:
3636
0 for no limit. [default: 50]
3737
--max-url INT Report only up to INT urls found in a file. Use 0
3838
for no limit. [default: 50]
39+
--unknown-licenses [EXPERIMENTAL] Detect unknown licenses.
3940

4041
output formats:
4142
--json FILE Write scan output as compact JSON to FILE.

0 commit comments

Comments
 (0)