From ea3ec1f27b24f6bcb55fdeb9047a6488c07e8233 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 2 Oct 2026 04:23:05 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9A=A1=20Bolt:=20Optimize=20regex=20repl?= =?UTF-8?q?acement=20in=20template=20init=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/init.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/init.py b/scripts/init.py index 06a0290..32f9b17 100644 --- a/scripts/init.py +++ b/scripts/init.py @@ -134,8 +134,9 @@ def update_file(filepath: str, file_replacements: list[tuple[re.Pattern, str]]): return new_content = content for pattern, replacement in file_replacements: - # Use a lambda for replacement to avoid regex backreference injection - new_content = pattern.sub(lambda _, r=replacement: r, new_content) + # Performance Optimization: Escape backslashes in replacement string so re.sub handles + # it directly in C without invoking a Python lambda function per match or risking Ruff B023. + new_content = pattern.sub(replacement.replace("\\", "\\\\"), new_content) if new_content != content: path.write_text(new_content) From c282eb037d4b02bbecbc9e9105ee2e48f1b84c5e Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 4 Oct 2026 22:11:38 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9A=A1=20Bolt:=20Remove=20comment=20in?= =?UTF-8?q?=20scripts/init.py=20as=20requested=20in=20PR=20review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/init.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/init.py b/scripts/init.py index 32f9b17..a22a614 100644 --- a/scripts/init.py +++ b/scripts/init.py @@ -134,8 +134,6 @@ def update_file(filepath: str, file_replacements: list[tuple[re.Pattern, str]]): return new_content = content for pattern, replacement in file_replacements: - # Performance Optimization: Escape backslashes in replacement string so re.sub handles - # it directly in C without invoking a Python lambda function per match or risking Ruff B023. new_content = pattern.sub(replacement.replace("\\", "\\\\"), new_content) if new_content != content: