Skip to content

Commit

Permalink
Merge pull request #160 from fosslight/max_lic
Browse files Browse the repository at this point in the history
Check empty license
  • Loading branch information
soimkim authored Jun 11, 2024
2 parents 467f89f + 1be9d52 commit e07778c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/fosslight_source/_scan_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,16 @@ def licenses(self, value):
if value:
max_length_exceed = False
for new_lic in value:
if len(new_lic) > MAX_LICENSE_LENGTH:
new_lic = new_lic[:MAX_LICENSE_LENGTH]
max_length_exceed = True
if new_lic not in self._licenses:
self._licenses.append(new_lic)
if len(",".join(self._licenses)) > MAX_LICENSE_TOTAL_LENGTH:
self._licenses.remove(new_lic)
if new_lic:
if len(new_lic) > MAX_LICENSE_LENGTH:
new_lic = new_lic[:MAX_LICENSE_LENGTH]
max_length_exceed = True
break
if new_lic not in self._licenses:
self._licenses.append(new_lic)
if len(",".join(self._licenses)) > MAX_LICENSE_TOTAL_LENGTH:
self._licenses.remove(new_lic)
max_length_exceed = True
break
if max_length_exceed and (SUBSTRING_LICENSE_COMMENT not in self.comment):
self.comment = f"{self.comment}/ {SUBSTRING_LICENSE_COMMENT}" if self.comment else SUBSTRING_LICENSE_COMMENT

Expand Down

0 comments on commit e07778c

Please sign in to comment.