Remove custom argparse action

pull/1359/head
Boyan-MILANOV 2 years ago
parent 32599e0d2c
commit 994c4438f6
  1. 10
      slither/__main__.py

@ -288,12 +288,6 @@ def parse_args(detector_classes, printer_classes): # pylint: disable=too-many-s
usage += "\t- 0x.. // a contract on mainet\n" usage += "\t- 0x.. // a contract on mainet\n"
usage += f"\t- NETWORK:0x.. // a contract on a different network. Supported networks: {','.join(x[:-1] for x in SUPPORTED_NETWORK)}\n" usage += f"\t- NETWORK:0x.. // a contract on a different network. Supported networks: {','.join(x[:-1] for x in SUPPORTED_NETWORK)}\n"
class NoFailPedanticAction(argparse.Action):
"""Custom argparse action that sets args.fail_pedantic to False if --no-fail-pedantic is used"""
def __call__(self, parser, namespace, values, option_string=None):
setattr(namespace, "fail_pedantic", False)
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="For usage information, see https://github.com/crytic/slither/wiki/Usage", description="For usage information, see https://github.com/crytic/slither/wiki/Usage",
usage=usage, usage=usage,
@ -411,8 +405,8 @@ def parse_args(detector_classes, printer_classes): # pylint: disable=too-many-s
group_detector.add_argument( group_detector.add_argument(
"--no-fail-pedantic", "--no-fail-pedantic",
help="Don't fail immediately if a finding is detected", help="Don't fail immediately if a finding is detected",
nargs=0, dest="fail_pedantic",
action=NoFailPedanticAction, action="store_false",
required=False, required=False,
) )

Loading…
Cancel
Save