Revert "Reduce verbosity for InvalidCompilation errors"

pull/2529/head
alpharush 3 months ago committed by GitHub
parent 16cfaa7d08
commit 4701885b24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      slither/__main__.py
  2. 20
      tests/e2e/test_cli.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)
slither_instances = []
results_detectors = []
results_printers = []

@ -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.")
Loading…
Cancel
Save