Skip to content

Commit

Permalink
Update category regex match in lint.py
Browse files Browse the repository at this point in the history
The "\$" in the regex string collides with Python's escape sequence in
string literals. Changing the string literal into a raw string literal to
treat backslashes as literal characters instead of trying to escape the
next character.
  • Loading branch information
rxxsta committed Dec 14, 2024
1 parent a30970f commit 18b8f96
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/test/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def check(self, path):
# utf-8-sig ignores BOM
file_content = open(path, "r", encoding="utf-8-sig").read()

match = re.search("\$category = ['\"](?P<category>[\w &/]+)['\"]", file_content)
match = re.search(r"\$category = ['\"](?P<category>[\w &/]+)['\"]", file_content)
if not match or match.group("category") not in self.CATEGORIES:
return True
return False
Expand Down

0 comments on commit 18b8f96

Please sign in to comment.