Skip to content

Commit 6ba75ba

Browse files
Apply comment
Signed-off-by: Wonjae Park <[email protected]>
1 parent 3561edf commit 6ba75ba

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/fosslight_source/_parsing_scancode_file_item.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,7 @@
3030
SPDX_REPLACE_WORDS = ["(", ")"]
3131
KEY_AND = r"(?<=\s)and(?=\s)"
3232
KEY_OR = r"(?<=\s)or(?=\s)"
33-
GPL_LICENSE_PATTERNS = [
34-
r'gpl', # gpl, gpl-2.0, gpl-3.0
35-
r'lgpl', # lgpl, lgpl-2.1, lgpl-3.0
36-
r'agpl', # agpl, agpl-3.0
37-
r'gnu.*general.*public.*license', # GNU General Public License
38-
r'gnu.*lesser.*general.*public.*license', # GNU Lesser General Public License
39-
r'gnu.*affero.*general.*public.*license' # GNU Affero General Public License
40-
]
33+
GPL_LICENSE_PATTERN = r'((a|l)?gpl|gfdl)' # GPL, LGPL, AGPL, GFDL
4134

4235

4336
def is_gpl_family_license(licenses: list) -> bool:
@@ -49,10 +42,9 @@ def is_gpl_family_license(licenses: list) -> bool:
4942
continue
5043

5144
license_lower = license_name.lower()
52-
for pattern in GPL_LICENSE_PATTERNS:
53-
if re.search(pattern, license_lower):
54-
logger.debug(f"GPL family license detected: {license_name}")
55-
return True
45+
if re.search(GPL_LICENSE_PATTERN, license_lower):
46+
logger.debug(f"GPL family license detected: {license_name}")
47+
return True
5648

5749
return False
5850

0 commit comments

Comments
 (0)