Skip to content

Commit e07778c

Browse files
authored
Merge pull request #160 from fosslight/max_lic
Check empty license
2 parents 467f89f + 1be9d52 commit e07778c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/fosslight_source/_scan_item.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,16 @@ def licenses(self, value):
7171
if value:
7272
max_length_exceed = False
7373
for new_lic in value:
74-
if len(new_lic) > MAX_LICENSE_LENGTH:
75-
new_lic = new_lic[:MAX_LICENSE_LENGTH]
76-
max_length_exceed = True
77-
if new_lic not in self._licenses:
78-
self._licenses.append(new_lic)
79-
if len(",".join(self._licenses)) > MAX_LICENSE_TOTAL_LENGTH:
80-
self._licenses.remove(new_lic)
74+
if new_lic:
75+
if len(new_lic) > MAX_LICENSE_LENGTH:
76+
new_lic = new_lic[:MAX_LICENSE_LENGTH]
8177
max_length_exceed = True
82-
break
78+
if new_lic not in self._licenses:
79+
self._licenses.append(new_lic)
80+
if len(",".join(self._licenses)) > MAX_LICENSE_TOTAL_LENGTH:
81+
self._licenses.remove(new_lic)
82+
max_length_exceed = True
83+
break
8384
if max_length_exceed and (SUBSTRING_LICENSE_COMMENT not in self.comment):
8485
self.comment = f"{self.comment}/ {SUBSTRING_LICENSE_COMMENT}" if self.comment else SUBSTRING_LICENSE_COMMENT
8586

0 commit comments

Comments
 (0)