From 3a1deb48a8c363a4c7dbe01ed7aeacba2cdcfd88 Mon Sep 17 00:00:00 2001 From: GalaxyGamingFR <153150716+GalaxyGamingFR@users.noreply.github.com> Date: Sun, 11 Oct 2026 02:33:20 -0700 Subject: [PATCH 1/2] fix(conventions): strip trailing tab from spaced diff paths Git appends a tab after file names containing spaces in the +++ header, so the added-lines key kept the tab and its suffix no longer matched. Comment, extension, title and silent-stub rules then skipped such files. The tab is now stripped, with a test covering core/a b.cpp. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01V9UU71SP1UKGR51Sowbgmq --- tools/check_conventions.py | 2 +- .../tests/test_check_conventions_comments.py | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/tools/check_conventions.py b/tools/check_conventions.py index b559a7be9..c1762f24d 100644 --- a/tools/check_conventions.py +++ b/tools/check_conventions.py @@ -66,7 +66,7 @@ class Check: path = None for line in git("diff", "-U0", "--no-color", "--no-renames", "--no-prefix", self.base, head).splitlines(): if line.startswith("+++ "): - path = None if line == "+++ /dev/null" else line[4:] + path = None if line == "+++ /dev/null" else line[4:].rstrip(" ") elif line.startswith("@@"): number = int(re.search(r"\+(\d+)", line).group(1)) elif line.startswith("+") and path: diff --git a/tools/tests/test_check_conventions_comments.py b/tools/tests/test_check_conventions_comments.py index 33fe1f9c6..a629714cc 100644 --- a/tools/tests/test_check_conventions_comments.py +++ b/tools/tests/test_check_conventions_comments.py @@ -226,5 +226,37 @@ class PullRequestTemplateTests(unittest.TestCase): self.assertEqual(self.findings("- [x] all"), []) +class SpacedPathTests(unittest.TestCase): + def test_comment_in_path_with_space_is_reported(self): + checker = Path(__file__).resolve().parents[1] / "check_conventions.py" + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + + def git(*args): + return subprocess.run( + ["git", "-c", "user.name=Conventions Test", "-c", "user.email=test@example.com", + "-c", "commit.gpgsign=false", *args], + cwd=root, capture_output=True, text=True, check=True, + ) + + git("init", "-q") + (root / "readme.txt").write_text("x\n", encoding="utf-8") + git("add", ".") + git("commit", "-qm", "docs: add readme") + source = root / "core/a b.cpp" + source.parent.mkdir(parents=True) + source.write_text("int x; // note\n", encoding="utf-8") + git("add", ".") + git("commit", "-qm", "feat: add spaced file") + result = subprocess.run( + [sys.executable, "-I", str(checker), "--base", "HEAD~1"], + cwd=root, capture_output=True, text=True, + env={key: value for key, value in os.environ.items() + if key not in ("GITHUB_EVENT_PATH", "GITHUB_STEP_SUMMARY", "GITHUB_ACTIONS")}, + ) + self.assertEqual(result.returncode, 1, result.stdout + result.stderr) + self.assertIn("core/a b.cpp:1: error: [comment]", result.stdout) + + if __name__ == "__main__": unittest.main() From 68f60cf34814587d59dc6c6018ecd4ec41089d95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Franch?= Date: Sun, 11 Oct 2026 11:53:35 +0200 Subject: [PATCH 2/2] fix(conventions): spell the stripped tab as an escape --- tools/check_conventions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/check_conventions.py b/tools/check_conventions.py index c1762f24d..ed761959e 100644 --- a/tools/check_conventions.py +++ b/tools/check_conventions.py @@ -66,7 +66,7 @@ class Check: path = None for line in git("diff", "-U0", "--no-color", "--no-renames", "--no-prefix", self.base, head).splitlines(): if line.startswith("+++ "): - path = None if line == "+++ /dev/null" else line[4:].rstrip(" ") + path = None if line == "+++ /dev/null" else line[4:].rstrip("\t") elif line.startswith("@@"): number = int(re.search(r"\+(\d+)", line).group(1)) elif line.startswith("+") and path: