mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1536763 - Support more than 100 files in ./mach static-analysis check, r=andi
Differential Revision: https://phabricator.services.mozilla.com/D24151 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
c87e4c2350
commit
9ca2ba47f7
@ -1716,13 +1716,17 @@ class StaticAnalysis(MachCommandBase):
|
||||
if rc != 0:
|
||||
return rc
|
||||
|
||||
# Split in several chunks to avoid hitting Python's limit of 100 groups in re
|
||||
compile_db = json.loads(open(self._compile_db, 'r').read())
|
||||
total = 0
|
||||
import re
|
||||
name_re = re.compile('(' + ')|('.join(source) + ')')
|
||||
for f in compile_db:
|
||||
if name_re.search(f['file']):
|
||||
total = total + 1
|
||||
chunk_size = 50
|
||||
for offset in range(0, len(source), chunk_size):
|
||||
source_chunks = source[offset:offset + chunk_size]
|
||||
name_re = re.compile('(' + ')|('.join(source_chunks) + ')')
|
||||
for f in compile_db:
|
||||
if name_re.search(f['file']):
|
||||
total = total + 1
|
||||
|
||||
if not total:
|
||||
return 0
|
||||
|
Loading…
Reference in New Issue
Block a user