We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 193fee1 commit ca75900Copy full SHA for ca75900
1 file changed
toolshed/check_spdx.py
@@ -24,10 +24,10 @@ def load_spdx_ignore():
24
return pathspec.PathSpec.from_lines("gitwildmatch", lines)
25
26
27
-def has_spdx(filepath):
+def has_spdx_or_is_empty(filepath):
28
with open(filepath, "rb") as f:
29
blob = f.read()
30
- return EXPECTED_SPDX_BYTES in blob
+ return len(blob.strip()) == 0 or EXPECTED_SPDX_BYTES in blob
31
32
33
def main(args):
@@ -37,7 +37,7 @@ def main(args):
37
38
returncode = 0
39
for filepath in args:
40
- if not ignore_spec.match_file(filepath) and not has_spdx(filepath):
+ if not ignore_spec.match_file(filepath) and not has_spdx_or_is_empty(filepath):
41
print(f"MISSING {EXPECTED_SPDX_STR} {filepath!r}")
42
returncode = 1
43
return returncode
0 commit comments