Skip to content

Commit 373cac7

Browse files
committed
Do not crash if license is missing
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent cb40371 commit 373cac7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/cluecode/plugin_filter_clues.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,12 @@ def from_scan_data(data):
164164
for a in detected_authors
165165
)
166166

167-
license_matches = list(chain.from_iterable(d['matches'] for d in data['license_detections']))
167+
license_matches = list(
168+
chain.from_iterable(
169+
d.get('matches', [])
170+
for d in data.get('license_detections', {})
171+
)
172+
)
168173

169174
detections = Detections(
170175
copyrights=detected_copyrights,

tests/cluecode/test_plugin_filter_clues.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_scan_plugin_filter_clues_does_not_filter_incorrectly():
5858

5959
# Regression on types tracked in https://github.com/nexB/typecode/issues/21
6060
def test_scan_plugin_filter_clues_for_license():
61-
# this test fies is a copy of pcre.LICENSE that contains
61+
# this test file is a copy of pcre.LICENSE that contains
6262
# several emails, authors, urls
6363
test_dir = test_env.get_test_loc('plugin_filter_clues/files/LICENSE3')
6464
result_file = test_env.get_temp_file('json')

0 commit comments

Comments
 (0)