Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions scarfer/format/format_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def _format_file(self, f, settings):
ret.append(" * {c}".format(c=cr))
if matches:
for m in f['license']['matches']:
ret.append("--- {match} --- ".format(match=m['key']))
ret.append("--- Matched license: {match} --- ".format(match=m['key']))
ret.append("--- Matched text: ---")
ret.append("{text}".format(text=m['text']))

return "\n".join(ret)
Expand All @@ -39,7 +40,6 @@ def _format_files(self, report, settings):

def format(self, report, settings):
results = [
"Files:\n----------------------------",
self._format_files(report, settings),
]
return "\n".join(results)
Expand Down Expand Up @@ -68,7 +68,7 @@ def format_license_summary(self, report, settings={}):
if settings.get('simplify'):
arbiter = Arbiter()
license_summary = arbiter.simplify_license(license_summary)['simplified']
return f'License:\n {license_summary}\n' # noqa: E231
return license_summary

def format_copyright_summary(self, report, settings={}):
copyright_summary = set()
Expand Down
10 changes: 8 additions & 2 deletions scarfer/scan_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,19 @@ def read(self):
_file['license'] = {}
matches = []
for le in f[self.licenses_value]:
vers = self.scancode_format[:3]
if vers == "3.0" or vers == "3.2" or vers == "4.0" or vers == "4.1":
vers = self.scancode_format[:3]
if vers == "3.0" or vers == "3.2":
for match in le['matches']:
matches.append({
"key": match['license_expression'],
"text": match['matched_text']
})
if vers == "4.0" or vers == "4.1":
for match in le['matches']:
matches.append({
"key": match['license_expression'],
"text": match['matched_text_diagnostics']
})
else:
if 'key' in le and 'matched_text' in le:
matches.append({
Expand Down
Loading