Repository: crytic/slither

Issue:
Slither crashes due to removed --solc-ast argument
The release of `0.6.3` moved compilation from the `slither` codebase into `crytic-compile`. With this, some compilation related arguments were removed/changed (`--disable-solc-warning`, `--solc-ast`, etc).

As a result of `--solc-ast` being removed, compilation on a standard directory (non-truffle, etc) will result in the following error:
```
ERROR:root:Traceback (most recent call last):
  File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 512, in main_impl
    extension = "*.sol" if not args.solc_ast else "*.json"
AttributeError: 'Namespace' object has no attribute 'solc_ast'
```

The relevant code which depended upon the `--solc-ast` argument must be modified.


Discussion:

Resolving patch:
diff --git a/slither/__main__.py b/slither/__main__.py
--- a/slither/__main__.py
+++ b/slither/__main__.py
@@ -205,6 +205,9 @@ def choose_printers(args, all_printer_classes):
     if args.printers_to_run is None:
         return []
 
+    if args.printers_to_run == 'all':
+        return all_printer_classes
+
     printers = {p.ARGUMENT: p for p in all_printer_classes}
     for p in args.printers_to_run.split(','):
         if p in printers:
@@ -245,7 +248,9 @@ def parse_filter_paths(args):
     'truffle_build_directory': 'build/contracts',
     'embark_ignore_compile': False,
     'embark_overwrite_config': False,
-    'legacy_ast': False
+    # debug command
+    'legacy_ast': False,
+    'ignore_return_value': False
     }
 
 def parse_args(detector_classes, printer_classes):
@@ -350,6 +355,11 @@ def parse_args(detector_classes, printer_classes):
                             dest='config_file',
                             default='slither.config.json')
 
+    group_misc.add_argument('--solc-ast',
+                            help='Provide the contract as a json AST',
+                            action='store_true',
+                            default=False)
+
     # debugger command
     parser.add_argument('--debug',
                         help=argparse.SUPPRESS,
@@ -386,7 +396,7 @@ def parse_args(detector_classes, printer_classes):
     parser.add_argument('--ignore-return-value',
                         help=argparse.SUPPRESS,
                         action='store_true',
-                        default=False)
+                        default=defaults_flag_in_config['ignore_return_value'])
 
     # if the json is splitted in different files
     parser.add_argument('--splitted',


Test patch:
diff --git a/scripts/travis_test_cli.sh b/scripts/travis_test_cli.sh
new file mode 100755
--- /dev/null
+++ b/scripts/travis_test_cli.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+### Test 
+
+slither "tests/*.json" --solc-ast --ignore-return-value
+
+if [ $? -ne 0 ]; then
+    echo "--solc-ast failed"
+    exit 1
+fi
+
+slither "tests/*0.5*.sol" --solc-disable-warnings --ignore-return-value
+
+if [ $? -ne 0 ]; then
+    echo "--solc-disable-warnings failed"
+    exit 1
+fi
+
+slither "tests/*0.5*.sol" --disable-color --ignore-return-value
+
+if [ $? -ne 0 ]; then
+    echo "--disable-color failed"
+    exit 1
+fi
diff --git a/scripts/travis_test_printers.sh b/scripts/travis_test_printers.sh
new file mode 100755
--- /dev/null
+++ b/scripts/travis_test_printers.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+### Test printer 
+
+slither "tests/*.json" --print all
+
+if [ $? -ne 0 ]; then
+    echo "Printer tests failed"
+    exit 1
+fi
+
diff --git a/scripts/travis_test_slither_config.sh b/scripts/travis_test_slither_config.sh
new file mode 100755
--- /dev/null
+++ b/scripts/travis_test_slither_config.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+### Test 
+
+slither "tests/*.json" --config "tests/config/slither.config.json" 
+
+if [ $? -ne 0 ]; then
+    echo "Config failed"
+    exit 1
+fi
+
diff --git a/tests/config/slither.config.json b/tests/config/slither.config.json
new file mode 100644
--- /dev/null
+++ b/tests/config/slither.config.json
@@ -0,0 +1,6 @@
+{
+    "detectors_to_run": "all",
+    "exclude_informational": true,
+    "exclude_low": true,
+    "ignore_return_value": true
+}