Do not compile regex state machines in a loop.
@@ -37,14 +37,14 @@ class ClangTidy(analyzer_base.SourceAnalyzer):
Skip clang static analyzer checkers.
Store them to checkers.
"""
+ pattern = re.compile(r'^\S+$')
for line in tidy_output.splitlines():
line = line.strip()
- if re.match(r'^Enabled checks:', line) or line == '':
+ if line.startswith('Enabled checks:') or line == '':
continue
elif line.startswith('clang-analyzer-'):
continue
- else:
- match = re.match(r'^\S+$', line)
+ match = pattern.match(line)
if match:
self.checkers.append((match.group(0), ''))
