Skip to content

Commit

Permalink
[Filters] Moved the compiled regex to _regex
Browse files Browse the repository at this point in the history
Cleaner string representation
  • Loading branch information
set-soft committed Aug 14, 2024
1 parent 1b3f3a9 commit 87f3323
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion kibot/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def warning(self, msg, *args, **kwargs):
else:
number = int(num_str)
for f in filters:
if (f.number == number or f.error == id) and f.regex.search(buf):
if (f.number == number or f.error == id) and f._regex.search(buf):
MyLogger.n_filtered += 1
return
MyLogger.warn_cnt += 1
Expand Down
2 changes: 1 addition & 1 deletion kibot/pre_drc.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def apply_filters(self, data):
else:
# Check if any filter matches this violation
for f in filters:
if type == f.error and f.regex.search(txt):
if type == f.error and f._regex.search(txt):
change_to = f.change_to if hasattr(f, 'change_to') else 'ignore'
if change_to == 'ignore':
if not excluded:
Expand Down
2 changes: 1 addition & 1 deletion kibot/pre_erc.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def apply_filters(self, data):
# Check if any filter matches this violation
excluded = violation.get('excluded')
for f in filters:
if type == f.error and f.regex.search(txt):
if type == f.error and f._regex.search(txt):
change_to = f.change_to if hasattr(f, 'change_to') else 'ignore'
if change_to == 'ignore':
if not excluded:
Expand Down
2 changes: 1 addition & 1 deletion kibot/pre_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def config(self, parent):
if comment:
parsed += '# '+comment+'\n'
parsed += '{},{}\n'.format(error, regex)
f.regex = re.compile(regex)
f._regex = re.compile(regex)
self._parsed = parsed


Expand Down

0 comments on commit 87f3323

Please sign in to comment.