Skip to content

Commit d433185

Browse files
TMHSDigitalclaude
andcommitted
fix: keep literal dashes out of validate_plugin.py
The dash check matched its own source because the pattern held literal en and em dash characters. Build the regex from code points instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MpEiWjv38TrdFcgqU8ER5L
1 parent 8812ced commit d433185

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎.github/scripts/validate_plugin.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ def check_rules():
185185
CREDENTIAL = re.compile(
186186
r"""password\s*=\s*["'][^"']+|api_key\s*=\s*["'][^"']+|token\s*=\s*["'][A-Za-z0-9]+""", re.IGNORECASE
187187
)
188+
DASHES = re.compile("[" + chr(0x2013) + chr(0x2014) + "]") # en and em dash
188189
CREDENTIAL_ALLOW = ("example", "placeholder", "mock", "destroyCancellationToken")
189190
FILE_SCOPED_NAMESPACE = re.compile(r"^\s*namespace\s+[A-Za-z0-9_.]+\s*;", re.MULTILINE)
190191
CSHARP10_ADVICE = re.compile(r"\b(use|prefer)\s+(file-scoped namespaces|primary constructors)", re.IGNORECASE)
@@ -198,7 +199,7 @@ def check_content():
198199
continue
199200
text = read(rel)
200201
for n, line in enumerate(text.splitlines(), 1):
201-
if "–" in line or "—" in line:
202+
if DASHES.search(line):
202203
errors.append(f"{rel}:{n}: em or en dash; use a hyphen or rewrite")
203204
if rel.endswith((".cs", ".py", ".json")) and CREDENTIAL.search(line):
204205
if not any(word in line for word in CREDENTIAL_ALLOW):

0 commit comments

Comments
 (0)