From 4701885b24bcef1272ccbcc8b7593e26f86c3df4 Mon Sep 17 00:00:00 2001 From: alpharush <0xalpharush@protonmail.com> Date: Mon, 12 Aug 2024 07:46:50 -0500 Subject: [PATCH] Revert "Reduce verbosity for InvalidCompilation errors" --- slither/__main__.py | 10 ++-------- tests/e2e/test_cli.py | 20 -------------------- 2 files changed, 2 insertions(+), 28 deletions(-) delete mode 100644 tests/e2e/test_cli.py diff --git a/slither/__main__.py b/slither/__main__.py index 58d276e1d..633ad68cf 100644 --- a/slither/__main__.py +++ b/slither/__main__.py @@ -14,7 +14,7 @@ from importlib import metadata from typing import Any, Dict, List, Optional, Sequence, Set, Tuple, Type, Union -from crytic_compile import cryticparser, CryticCompile, InvalidCompilation +from crytic_compile import cryticparser, CryticCompile from crytic_compile.platform.standard import generate_standard_export from crytic_compile.platform.etherscan import SUPPORTED_NETWORK from crytic_compile import compile_all, is_supported @@ -93,13 +93,7 @@ def process_all( detector_classes: List[Type[AbstractDetector]], printer_classes: List[Type[AbstractPrinter]], ) -> Tuple[List[Slither], List[Dict], List[Output], int]: - - try: - compilations = compile_all(target, **vars(args)) - except InvalidCompilation: - logger.error("Unable to compile all targets.") - sys.exit(2) - + compilations = compile_all(target, **vars(args)) slither_instances = [] results_detectors = [] results_printers = [] diff --git a/tests/e2e/test_cli.py b/tests/e2e/test_cli.py deleted file mode 100644 index 72e0441d6..000000000 --- a/tests/e2e/test_cli.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import tempfile -import pytest - -from slither.__main__ import main_impl - - -def test_cli_exit_on_invalid_compilation_file(caplog): - - with tempfile.NamedTemporaryFile("w") as f: - f.write("pragma solidity ^0.10000.0;") - - sys.argv = ["slither", f.name] - with pytest.raises(SystemExit) as pytest_wrapped_e: - main_impl([], []) - - assert pytest_wrapped_e.type == SystemExit - assert pytest_wrapped_e.value.code == 2 - - assert caplog.record_tuples[0] == ("Slither", 40, "Unable to compile all targets.")