Skip to content

Commit 99eef72

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 929585f commit 99eef72

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pre_commit_hooks/check_spdx.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
"""This script checks for the presence of an SPDX-License-Identifier in the comments of source files."""
32
from __future__ import annotations
43

@@ -9,17 +8,17 @@
98

109
def _load_file(file_path: str) -> str:
1110
try:
12-
with open(file_path, 'r', encoding='utf-8') as f:
11+
with open(file_path, encoding='utf-8') as f:
1312
return f.read()
1413
except Exception as e:
15-
print(f"Error loading file content of {file_path}: {e}")
14+
print(f"Error loading file content of {file_path}: {e}")
1615

1716

1817
def _check_spdx(file_content: str) -> bool:
1918
for line in file_content:
2019
stripped_line = line.strip()
21-
if stripped_line.startswith("#") or stripped_line.startswith("//") or re.match(r"^\s*/\*", stripped_line):
22-
if "SPDX-License-Identifier:" in stripped_line:
20+
if stripped_line.startswith('#') or stripped_line.startswith('//') or re.match(r'^\s*/\*', stripped_line):
21+
if 'SPDX-License-Identifier:' in stripped_line:
2322
return True
2423
else:
2524
break

0 commit comments

Comments
 (0)