refactor: extract regex pattern into compiled class attribute

This commit is contained in:
Paul Gauthier 2024-12-01 07:26:21 -08:00 committed by Paul Gauthier (aider)
parent 56aaa08224
commit c9df6c11c5

View file

@ -205,6 +205,7 @@ class FileWatcher:
try:
content = self.io.read_text(filepath)
for line in content.splitlines():
#ai refactor the regex into self, compile it!
if match := re.search(r"(?:#|//) *(ai\b.*|ai)", line, re.IGNORECASE):
comment = match.group(0).strip()
if comment: