Add --no-fail-pedantic flag and make failing the default behavior

pull/1359/head
Boyan-MILANOV 2 years ago
parent 78397b94dd
commit 0ab3d50fa3
  1. 12
      slither/__main__.py
  2. 2
      slither/utils/command_line.py

@ -288,6 +288,12 @@ 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,
@ -402,6 +408,12 @@ def parse_args(detector_classes, printer_classes): # pylint: disable=too-many-s
default=defaults_flag_in_config["fail_pedantic"], default=defaults_flag_in_config["fail_pedantic"],
) )
group_detector.add_argument(
"--no-fail-pedantic",
help="Don't fail immediately if a finding is detected",
action=NoFailPedanticAction,
)
group_detector.add_argument( group_detector.add_argument(
"--fail-low", "--fail-low",
help="Fail if low or greater impact finding is detected", help="Fail if low or greater impact finding is detected",

@ -34,7 +34,7 @@ defaults_flag_in_config = {
"exclude_low": False, "exclude_low": False,
"exclude_medium": False, "exclude_medium": False,
"exclude_high": False, "exclude_high": False,
"fail_pedantic": False, "fail_pedantic": True,
"fail_low": False, "fail_low": False,
"fail_medium": False, "fail_medium": False,
"fail_high": False, "fail_high": False,

Loading…
Cancel
Save