fix(conventions): check the whole repository when run from a subdirectory #4368
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4368"
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 SandstromPL on 2026-10-12T07:51:43Z.
What
Two git calls in
tools/check_conventions.pyresolve paths against the current directory. Run from anywhere but the repository root, for example fromtools/or from a build folder aspython3 ../tools/check_conventions.py, the checker gives wrong results without any warning:git ls-tree -rz <head>lists only the current directory's subtree, with paths relative to it. Fromtools/,self.treeholds 30 paths instead of the whole tree. As a result:doc-linkerror;docs/dev/TechnicalDebt.md, so stubs already listed there are reported assilent-stub;repository()see no submodules, so a3rdparty/submodule without a.gitmodulesurl passes, and one outside3rdparty/crashes the check.git grep … -- core/libs/prxsearches<cwd>/core/libs/prx. From a subdirectory it finds nothing, so a realduplicate-exportpasses.ls-treenow gets--full-tree. The grep gets--full-nameand the pathspec:(top)core/libs/prx, so it searches from the top of the repository and prints root-relative paths, which is whatduplicates()parses. With default configuration, the other git calls (diff,show <rev>:<path>,log,config --blob) already work from any directory. CI runs from the repository root, where the output does not change.Tested
Ubuntu 24.04, Python 3.12.3, git 2.43:
tools/testsfiles pass, including 32 tests intest_check_conventions_comments.py. The newtest_checks_from_a_subdirectory_see_the_whole_repositorycommits two libraries that define the same export, plus a document that links intocore/, and runs the check fromtools/. It expects only theduplicate-exportfinding. With main's checker the test fails: it reports a falsedoc-linkand misses the duplicate.--base <c>^1 --head <c>):tools/than from the root.tools/matches the root for all 40.tools/:0f6205aa3(#153): from the root, main's checker reports 5duplicate-exporterrors; fromtools/it reports none of them.6731a610e(#3470, the stray3rdparty/imguigitlink): the root reports thesystem-dependencyerror. Fromtools/, main's checker reports a falsedoc-linkand a falsesilent-stubinstead.tools/check_conventions.pyfrom main passes with this title and body.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T07:53:39Z.
I ran
python3 tools/tests/test_check_conventions_comments.pyon PR head872c3ba6in the Linux workspace. All 32 tests passed, including the new subdirectory regression case. This was the focused test file only; I did not rerun the broader tools suite.Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-12T07:56:42Z.
Thanks for checking. For completeness: all 15
tools/testsfiles pass on872c3ba6here as well (Ubuntu 24.04, Python 3.12.3), as listed under Tested.