|
|
@ -30,7 +30,8 @@ def slither_format(slither, **kwargs): |
|
|
|
detectors_to_run (str): Comma-separated list of detectors, defaults to all |
|
|
|
detectors_to_run (str): Comma-separated list of detectors, defaults to all |
|
|
|
''' |
|
|
|
''' |
|
|
|
|
|
|
|
|
|
|
|
detectors_to_run = choose_detectors(kwargs.get('detectors_to_run', 'all')) |
|
|
|
detectors_to_run = choose_detectors(kwargs.get('detectors_to_run', 'all'), |
|
|
|
|
|
|
|
kwargs.get('detectors_to_exclude', '')) |
|
|
|
|
|
|
|
|
|
|
|
for detector in detectors_to_run: |
|
|
|
for detector in detectors_to_run: |
|
|
|
slither.register_detector(detector) |
|
|
|
slither.register_detector(detector) |
|
|
@ -64,6 +65,9 @@ def slither_format(slither, **kwargs): |
|
|
|
result['paches_diff'] = diff |
|
|
|
result['paches_diff'] = diff |
|
|
|
if skip_file_generation: |
|
|
|
if skip_file_generation: |
|
|
|
continue |
|
|
|
continue |
|
|
|
|
|
|
|
if not diff: |
|
|
|
|
|
|
|
logger.info(f'Empty patch generated {result}') |
|
|
|
|
|
|
|
continue |
|
|
|
path = os.path.join(export, f'fix_{counter}.patch') |
|
|
|
path = os.path.join(export, f'fix_{counter}.patch') |
|
|
|
logger.info(f'\t- {path}') |
|
|
|
logger.info(f'\t- {path}') |
|
|
|
with open(path, 'w') as f: |
|
|
|
with open(path, 'w') as f: |
|
|
@ -78,15 +82,21 @@ def slither_format(slither, **kwargs): |
|
|
|
################################################################################### |
|
|
|
################################################################################### |
|
|
|
################################################################################### |
|
|
|
################################################################################### |
|
|
|
|
|
|
|
|
|
|
|
def choose_detectors(detectors_to_run): |
|
|
|
def choose_detectors(detectors_to_run, detectors_to_exclude): |
|
|
|
# If detectors are specified, run only these ones |
|
|
|
# If detectors are specified, run only these ones |
|
|
|
cls_detectors_to_run = [] |
|
|
|
cls_detectors_to_run = [] |
|
|
|
|
|
|
|
exclude = detectors_to_exclude.split(',') |
|
|
|
if detectors_to_run == 'all': |
|
|
|
if detectors_to_run == 'all': |
|
|
|
for d in all_detectors: |
|
|
|
for d in all_detectors: |
|
|
|
|
|
|
|
if d in exclude: |
|
|
|
|
|
|
|
continue |
|
|
|
cls_detectors_to_run.append(all_detectors[d]) |
|
|
|
cls_detectors_to_run.append(all_detectors[d]) |
|
|
|
else: |
|
|
|
else: |
|
|
|
|
|
|
|
exclude = detectors_to_exclude.split(',') |
|
|
|
for d in detectors_to_run.split(','): |
|
|
|
for d in detectors_to_run.split(','): |
|
|
|
if d in all_detectors: |
|
|
|
if d in all_detectors: |
|
|
|
|
|
|
|
if d in exclude: |
|
|
|
|
|
|
|
continue |
|
|
|
cls_detectors_to_run.append(all_detectors[d]) |
|
|
|
cls_detectors_to_run.append(all_detectors[d]) |
|
|
|
else: |
|
|
|
else: |
|
|
|
raise Exception('Error: {} is not a detector'.format(d)) |
|
|
|
raise Exception('Error: {} is not a detector'.format(d)) |
|
|
|