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:
Bastien Abadie 2019-03-20 13:03:13 +00:00
Родитель c87e4c2350
Коммит 9ca2ba47f7
1 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -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