@@ -171,7 +171,8 @@ def get_licenses(location, min_score=0,
171171
172172 detected_licenses = []
173173 detected_expressions = []
174-
174+ unknown_expressions = []
175+ unknown_licenses = []
175176 matches = idx .match (
176177 location = location , min_score = min_score , deadline = deadline , ** kwargs )
177178
@@ -180,16 +181,23 @@ def get_licenses(location, min_score=0,
180181 for match in matches :
181182 qspans .append (match .qspan )
182183
183- detected_expressions .append (match .rule .license_expression )
184-
185- detected_licenses .extend (
186- _licenses_data_from_match (
184+ if "unknown" in match .rule .license_expression : # TODO: use is_unknwon flag instead
185+ unknown_expressions .append (match .rule .license_expression )
186+ unknown_licenses .extend (_licenses_data_from_match (
187+ match = match ,
188+ include_text = include_text ,
189+ license_text_diagnostics = license_text_diagnostics ,
190+ license_url_template = license_url_template ))
191+ else :
192+ detected_expressions .append (match .rule .license_expression )
193+ detected_licenses .extend (
194+ _licenses_data_from_match (
187195 match = match ,
188196 include_text = include_text ,
189197 license_text_diagnostics = license_text_diagnostics ,
190198 license_url_template = license_url_template )
191- )
192-
199+ )
200+
193201 percentage_of_license_text = 0
194202 if match :
195203 # we need at least one match to compute a license_coverage
@@ -200,7 +208,9 @@ def get_licenses(location, min_score=0,
200208 detected_spdx_expressions = []
201209 return dict ([
202210 ('licenses' , detected_licenses ),
211+ ('unknown_licenses' , unknown_licenses ),
203212 ('license_expressions' , detected_expressions ),
213+ ('unknown_license_expressions' , unknown_expressions ),
204214 ('spdx_license_expressions' , detected_spdx_expressions ),
205215 ('percentage_of_license_text' , percentage_of_license_text ),
206216 ])
0 commit comments