Merge pull request #51 from redshark1802/feature/filename-globbing

add support for supplying a glob in addition to file and folder
pull/55/head
Feist Josselin 6 years ago committed by GitHub
commit 424225d69d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      README.md
  2. 6
      slither/__main__.py

@ -17,7 +17,7 @@ Slither is a Solidity static analysis framework written in Python 3. It runs a s
## Usage
```
$ slither tests/uninitialized.sol
$ slither tests/uninitialized.sol # argument can be file, folder or glob, be sure to quote the argument when using a glob
[..]
INFO:Detectors:Uninitialized state variables in tests/uninitialized.sol, Contract: Uninitialized, Vars: destination, Used in ['transfer']
[..]

@ -189,12 +189,16 @@ def main_impl(all_detector_classes, all_printer_classes):
try:
filename = args.filename
globbed_filenames = glob.glob(filename, recursive=True)
if os.path.isfile(filename):
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
elif os.path.isdir(filename):
elif os.path.isdir(filename) or len(globbed_filenames) > 0:
extension = "*.sol" if not args.solc_ast else "*.json"
filenames = glob.glob(os.path.join(filename, extension))
if len(filenames) == 0:
filenames = globbed_filenames
number_contracts = 0
results = []
for filename in filenames:

Loading…
Cancel
Save