Repository navigation
fix(tools): accept licence notices in the conventions check - #16580
Conversation
The checker could not tell a required upstream licence notice from an undocumented comment, so adding one needed an unrelated debt-file touch as a workaround. Recognize the notice by its own text instead.
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
Add cases for a marker on the same line as code (still reported), a marker sharing its line with unrelated text (still exempt, documenting the limitation), and rename the leading-header case to say what it actually covers. Revert the CONVENTIONS.md wording change; the debt entry removal stays.
|
Windows check of head Setup: Windows 11 Enterprise 22621, Python 3.15.1,
AI-assisted: yes. |
|
Linux verification (CachyOS x86-64, Python 3.13): the conventions test suite passes 219 of 219 including the new licence cases, and I probed the rule end-to-end through the real script on this head, holding
One observation from the same probes: AI-assisted: yes |
Thanks! The adjacent-comment case is the known limitation in the description. Requiring a marker per block would flag 13 of 22 header blocks in Math.cpp (the “Derived from…” lines), so I kept the run-level rule. AI-assisted: yes |
What
The conventions checker could not tell a required upstream licence notice
from an undocumented comment, so
Math.cppandSignalList.cppneeded anunrelated debt-file touch to add one. It now recognizes a notice by its own
text (
SPDX-License-Identifier,Copyrightwith(c)/©/a year,Permission is hereby granted,Permission to use, copy, modify, orRedistribution and use in source and binary forms) and exempts itsunbroken run of comment lines, stopping at the first blank line or line of
code on either side; a comment on the same line as code is never exempt.
Known limitation: a comment glued directly to an existing notice, with no
blank line between them, is exempted too — the rule checks the whole run
for a marker, not each line. The same goes for a comment that contains a
marker itself alongside unrelated text (
// Copyright 2025 TODO: hackpasses): the rule trusts marker text, it doesn't parse intent. A plain
// TODOstill needs a blank-line or code separator from the nearestnotice to be caught.
Removes the closed entry in
docs/dev/debt/libc.md. I leftdocs/dev/CONVENTIONS.mdunchanged so the wording of the exception isyours; happy to add a line if you'd like. The blanket "any debt file
touched anywhere in the diff waives every comment" behaviour is unchanged
and still used by other comments (e.g.
libSceConvertKeycode/ImeKeyboardType.hpp:9).Tooling only; no title involved.
Tested
Linux (Arch, kernel 7.0.11-arch1-1), Python 3.14.5. Tools-only change; no
build or ctest applies.
Math.cppdiff: 4[comment]errorsbefore this fix, 0 after.
python3 -m pytest tools/tests/test_check_conventions*.py: 216 passed,176 subtests.
python3 tools/check_conventions.py --base origin/main: passed.python3 tools/pr_overlap.py --branch fix/conventions-license-notices:127 open PRs touch the shared
docs/dev/debt/libc.md. docs(debt): separate entries with blank lines and drop derived export totals #14212 also editstools/check_conventions.py, but an unrelated rule at a differentlocation; it touches the same debt-entry line this PR deletes, so
whichever merges second rebases.
Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repository