fix(conventions): check comments in GLSL shaders #5766
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5766"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by GalaxyGamingFR on 2026-10-14T09:54:42Z.
What
The
commentrule intools/check_conventions.pyonly scanned C++, Python and CMake files, so a comment added to a.comp,.fragor.vertshader passed the check, although CONVENTIONS.md allows comments only for technical debt.TextureDetile.compandColorTransfer.compalready carry such comments (both added before the checker existed). A newshaders()step masks shaders with the same C-style lexer as C++ (cpp_text, so//inside a string is not a comment) and reportscommenton changed lines, with the same#endifallowance and the same technical-debt exemption as C++. Only changed lines are checked, so the existing shaders do not fail until they are edited.Tested
Windows 11, Python 3.12. No C++ changes.
tools/tests/test_check_conventions_comments.py: newtest_comment_in_a_shader_is_reported(4 subtests://and/* */in a.compunderGraphics/shadersand a.fragundertests/shaders) fails onmainand passes with this change; newtest_shader_without_comments_passes(a"a//b"string and#endif // X) passes.CMakeLists.txtis unchanged.tools/tests/test_*.pypasses;python -I tools/check_conventions.py --base origin/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
https://claude.ai/code/session_012zyXkUzTZGh3nBwNMtrLaW
Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-14T22:02:16Z.
Checked on a worktree of this branch (Linux, Python 3), not a build:
python3 -m unittest tools.tests.test_check_conventions_comments: 55 tests OK. Withtools/check_conventions.pyreset to main and the new tests kept, 1 of the 55 tests fails (4 of its subtests: .comp and .frag, each with//and/* */), so the new tests exercise the rule.check_conventions.py --base upstream/main --head <this branch>: passes.TextureDetile.comp,ColorTransfer.comp). Touching one of them without adding a comment reports nothing; adding a// ...on a line reports[comment]for that line only. So the rule judges added lines, not whole files.The branch was about 660 commits behind main when I checked, so the
--base upstream/mainpass compared against a much newer base.Not checked:
.glsl,.geomor other shader extensions (the rule covers .comp, .frag, .vert), and block comments that span several lines where only the middle line is added.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:09:23Z.
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.
tools/check_conventions.pyImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T12:45:19Z.
Checked on the PR merged onto current main:
tools/testspass, the new shader test fails without the change (4 subtests) and passes with it, no false positive on"a//b"strings or#endif // X.One gap fixed in a follow-up commit on your branch (
1b94074869):.glslfiles (e.g.PqToSdr.glsl) were not covered, so the suffix list now includes.glsl, with a test case. Rebased on main as well. Merging once CI is green.