The SPDX gate fails on a file it cannot read instead of skipping it, and the changelog says licence
A silent skip would let an unmarked file through, which is the one thing the test exists to catch. The two new changelog lines now read in the file's own voice, and a docstring in the logging tests is wrapped under the line limit. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
ea5b6b2b62
commit
e7fb14bed0
3 files changed
+9
-20
No files matched your search
+2
-2
@@ -19,9 +19,9 @@ allowed to change behaviour, not just add to it.
|
||||
|
||||
### Added
|
||||
|
||||
- **All Python files declare their license with SPDX identifiers** on line 1 (or line 2 after a shebang), enforced by a new `tests/test_spdx.py` gate. A file lifted from the repository carries no license marking otherwise.
|
||||
- **Every Python file names its licence with an SPDX identifier** on its first line (second, after a shebang), and `tests/test_spdx.py` keeps a new file from landing without one. Apache-2.0 does not require per-file headers, but a file lifted out of the tree carried no marking at all.
|
||||
|
||||
- **The XIAO firmware patch and builder carry the MeshCore MIT license** in `scripts/xiao-radio/LICENSE.MeshCore`, and the dual-licensing of the shared font generator (Apache-2.0 and GPL-2.0-only) is documented in the script headers and `docs/hardware.md`.
|
||||
- **The XIAO firmware patch carries MeshCore's MIT notice beside it** as `scripts/xiao-radio/LICENSE.MeshCore`, and the console-font scripts state that the shared generator block is offered under GPL-2.0-only as well as Apache-2.0, which is what lets the GPL-2.0-only 6×8 script run it.
|
||||
|
||||
- **The SPI radio bridge runs on `openhop_core`.** The library the uConsole's software
|
||||
node runs on was renamed from `pymc_core` in 2026, and the current `meshcore-uconsole`
|
||||
|
||||
@@ -103,8 +103,8 @@ def test_a_level_name_becomes_a_level(tmp_path: Path) -> None:
|
||||
def test_a_nonsense_level_still_starts_the_app() -> None:
|
||||
"""A typo in a hand-edited preferences file loses log detail, not the app.
|
||||
|
||||
Someone editing the preferences file by hand and writing ``WARN`` should get a slightly quieter log,
|
||||
not a program that refuses to launch.
|
||||
Someone editing the preferences file by hand and writing ``WARN`` should get a
|
||||
slightly quieter log, not a program that refuses to launch.
|
||||
"""
|
||||
assert level_from_name("WARN") == logging.WARNING
|
||||
assert level_from_name("") == logging.WARNING
|
||||
+5
-16
@@ -34,22 +34,11 @@ def test_spdx_headers():
|
||||
|
||||
missing_spdx = []
|
||||
for filepath in sorted(python_files):
|
||||
try:
|
||||
content = filepath.read_text(encoding="utf-8")
|
||||
lines = content.split("\n", 2) # Check first 2 lines max
|
||||
|
||||
# Check for SPDX identifier on line 1 or 2
|
||||
has_spdx = False
|
||||
if lines and "SPDX-License-Identifier:" in lines[0]:
|
||||
has_spdx = True
|
||||
elif len(lines) > 1 and "SPDX-License-Identifier:" in lines[1]:
|
||||
has_spdx = True
|
||||
|
||||
if not has_spdx:
|
||||
missing_spdx.append(str(filepath.relative_to(repo_root)))
|
||||
except Exception:
|
||||
# Skip files that can't be read
|
||||
continue
|
||||
# A file that cannot be read as UTF-8 is a finding, not something to skip: every
|
||||
# source file here is UTF-8, and a silent skip would let an unmarked file through.
|
||||
head = filepath.read_text(encoding="utf-8").split("\n", 2)[:2]
|
||||
if not any("SPDX-License-Identifier:" in line for line in head):
|
||||
missing_spdx.append(str(filepath.relative_to(repo_root)))
|
||||
|
||||
assert not missing_spdx, (
|
||||
f"Found {len(missing_spdx)} Python file(s) without SPDX-License-Identifier:\n"
|
||||
|
||||
Reference in new issue
Block a user