Fix regex for invalid placeholders (#7738)

This issue added some false positives to the list and broke the string synchronization.
This commit is contained in:
Jorge Martin Espinosa
2026-09-21 14:35:33 +02:00
committed by GitHub
parent 3c3e8f8f6f
commit 84a907d906
+2 -1
View File
@@ -47,8 +47,9 @@ forbiddenTerms = {
# %s %d %f ... -> simple conversion
# %1$s %2$d ... -> positional
# %.2f %1$.2f -> optional precision
# It also contains a trailing dot to catch cases like "%s." which are valid placeholders but will be flagged as invalid by the regex.
_VALID_PLACEHOLDER = re.compile(
r'%(?:\d+\$)?(?:\.\d+)?[a-zA-Z]'
r'%(?:\d+\$)?(?:\.\d+)?[a-zA-Z]\.*'
)
# Grab each candidate token: a '%' plus the run of chars that could belong to a