pull/238/head
Josselin 5 years ago
parent bc18014878
commit 528cae028a
  1. 42
      slither/utils/command_line.py
  2. 14
      utils/slither_format/formatters/naming_convention.py

@ -47,48 +47,6 @@ def read_config_file(args):
logger.error(red('Impossible to read {}, please check the file {}'.format(args.config_file, e)))
logger = logging.getLogger("Slither")
# Those are the flags shared by the command line and the config file
defaults_flag_in_config = {
'detectors_to_run': 'all',
'printers_to_run': None,
'detectors_to_exclude': None,
'exclude_informational': False,
'exclude_low': False,
'exclude_medium': False,
'exclude_high': False,
'solc': 'solc',
'solc_args': None,
'disable_solc_warnings': False,
'json': None,
'truffle_version': None,
'disable_color': False,
'filter_paths': None,
'truffle_ignore_compile': False,
'truffle_build_directory': 'build/contracts',
'embark_ignore_compile': False,
'embark_overwrite_config': False,
# debug command
'legacy_ast': False,
'ignore_return_value': False
}
def read_config_file(args):
if os.path.isfile(args.config_file):
try:
with open(args.config_file) as f:
config = json.load(f)
for key, elem in config.items():
if key not in defaults_flag_in_config:
logger.info(yellow('{} has an unknown key: {} : {}'.format(args.config_file, key, elem)))
continue
if getattr(args, key) == defaults_flag_in_config[key]:
setattr(args, key, elem)
except json.decoder.JSONDecodeError as e:
logger.error(red('Impossible to read {}, please check the file {}'.format(args.config_file, e)))
def output_to_markdown(detector_classes, printer_classes, filter_wiki):
def extract_help(cls):

@ -405,23 +405,22 @@ def _explore_types(slither, result, target, convert, type, filename_source_code,
if isinstance(type, MappingType):
# Mapping has three steps:
# Convertir the "from" type
# Convertir the "to" type
# Convertir nested type in the "from"
# Convert the "from" type
# Convert the "to" type
# Convert nested type in the "from"
# Ex: mapping (mapping (badName => uint) => uint)
# Do the comparison twice, so we can factor together the re matching
if isinstance(type.type_from, UserDefinedType) or target in [type.type_from, type.type_to]:
old_str = type.type.name
new_str = convert(old_str)
full_txt_start = start
full_txt_end = end
full_txt = slither.source_code[filename_source_code][full_txt_start:full_txt_end]
re_match = re.match(RE_MAPPING, full_txt)
if type.type_from == target:
old_str = type.type_from.name
new_str = convert(old_str)
loc_start = start + re_match.start(1)
loc_end = loc_start + len(old_str)
@ -435,6 +434,9 @@ def _explore_types(slither, result, target, convert, type, filename_source_code,
if type.type_to == target:
old_str = type.type_to.name
new_str = convert(old_str)
loc_start = start + re_match.start(2)
loc_end = loc_start + len(old_str)

Loading…
Cancel
Save