From 2bd6cbeddde8dd89a10ecbd3ba3a0f96f994b602 Mon Sep 17 00:00:00 2001 From: Alexis Date: Mon, 8 Apr 2024 10:50:15 +0200 Subject: [PATCH] Remove deprecated flags and their migration. --- slither/utils/command_line.py | 35 ------------------- .../test_path_filtering/slither.config.json | 2 +- 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/slither/utils/command_line.py b/slither/utils/command_line.py index f03ced8345..a37e859133 100644 --- a/slither/utils/command_line.py +++ b/slither/utils/command_line.py @@ -75,13 +75,6 @@ class FailOnLevel(enum.Enum): **DEFAULTS_FLAG_IN_CONFIG_CRYTIC_COMPILE, } -deprecated_flags = { - "fail_pedantic": True, - "fail_low": False, - "fail_medium": False, - "fail_high": False, -} - def read_config_file(args: argparse.Namespace) -> None: # No config file was provided as an argument @@ -98,12 +91,6 @@ def read_config_file(args: argparse.Namespace) -> None: with open(args.config_file, encoding="utf8") as f: config = json.load(f) for key, elem in config.items(): - if key in deprecated_flags: - logger.info( - yellow(f"{args.config_file} has a deprecated key: {key} : {elem}") - ) - migrate_config_options(args, key, elem) - continue if key not in defaults_flag_in_config: logger.info( yellow(f"{args.config_file} has an unknown key: {key} : {elem}") @@ -118,28 +105,6 @@ def read_config_file(args: argparse.Namespace) -> None: logger.error(yellow("Falling back to the default settings...")) -def migrate_config_options(args: argparse.Namespace, key: str, elem): - if key.startswith("fail_") and getattr(args, "fail_on") == defaults_flag_in_config["fail_on"]: - if key == "fail_pedantic": - pedantic_setting = elem - fail_on = FailOnLevel.PEDANTIC if pedantic_setting else FailOnLevel.NONE - setattr(args, "fail_on", fail_on) - logger.info(f"Migrating fail_pedantic: {pedantic_setting} as fail_on: {fail_on.value}") - elif key == "fail_low" and elem is True: - logger.info("Migrating fail_low: true -> fail_on: low") - setattr(args, "fail_on", FailOnLevel.LOW) - - elif key == "fail_medium" and elem is True: - logger.info("Migrating fail_medium: true -> fail_on: medium") - setattr(args, "fail_on", FailOnLevel.MEDIUM) - - elif key == "fail_high" and elem is True: - logger.info("Migrating fail_high: true -> fail_on: high") - setattr(args, "fail_on", FailOnLevel.HIGH) - else: - logger.warning(yellow(f"Key {key} was deprecated but no migration was provided")) - - def output_to_markdown( detector_classes: List[Type[AbstractDetector]], printer_classes: List[Type[AbstractPrinter]], diff --git a/tests/e2e/config/test_path_filtering/slither.config.json b/tests/e2e/config/test_path_filtering/slither.config.json index 95aac92b06..0c365eac75 100644 --- a/tests/e2e/config/test_path_filtering/slither.config.json +++ b/tests/e2e/config/test_path_filtering/slither.config.json @@ -2,6 +2,6 @@ "detectors_to_run": "all", "exclude_informational": true, "exclude_low": true, - "fail_pedantic": false, + "fail_on": "none", "filter_paths": "libs|src/ReentrancyMock.sol" }