From 6464978b259747c64d137e3aee500039389f7113 Mon Sep 17 00:00:00 2001 From: Max Jones <14077947+maxrjones@users.noreply.github.com> Date: Mon, 9 Mar 2026 17:50:40 -0400 Subject: [PATCH 1/2] chore: Pre-commit hook for multi-character lstrip/rstrip --- .pre-commit-config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f86fb3d9c1..5b147fb532 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -54,6 +54,14 @@ repos: rev: v1.10.0 hooks: - id: numpydoc-validation + - repo: local + hooks: + - id: ban-lstrip-rstrip + name: ban lstrip/rstrip + language: pygrep + entry: "\\.(lstrip|rstrip)\\([\"'][^\"']{2,}[\"']\\)" + types: [python] + files: ^(src|tests)/ - repo: https://github.com/twisted/towncrier rev: 25.8.0 hooks: From bfbfcec292333c857d7dc571fb04f9e3a42f9ca9 Mon Sep 17 00:00:00 2001 From: Max Jones <14077947+maxrjones@users.noreply.github.com> Date: Mon, 9 Mar 2026 17:53:28 -0400 Subject: [PATCH 2/2] Comment --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5b147fb532..37f41b8222 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -59,6 +59,7 @@ repos: - id: ban-lstrip-rstrip name: ban lstrip/rstrip language: pygrep + # Matches .lstrip() or .rstrip() where the string argument is 2+ characters. entry: "\\.(lstrip|rstrip)\\([\"'][^\"']{2,}[\"']\\)" types: [python] files: ^(src|tests)/