diff --git a/.github/workflows/IR.yml b/.github/workflows/IR.yml index 7b5d214a9..0471cb876 100644 --- a/.github/workflows/IR.yml +++ b/.github/workflows/IR.yml @@ -33,13 +33,7 @@ jobs: - name: Install dependencies run: | - python setup.py install - pip install deepdiff - pip install pytest==7.0.1 - pip install typing_extensions==4.1.1 - pip install importlib_metadata==4.8.3 - - pip install "solc-select>=v1.0.0b1" + pip install ".[dev]" solc-select install all solc-select use 0.8.11 diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index c1a999b80..5292c1b57 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -29,8 +29,8 @@ jobs: - name: Install dependencies run: | - pip install . - pip install deepdiff numpy + pip install ".[dev]" + pip install numpy mkdir -p .github/linters cp pyproject.toml .github/linters diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1252e385a..5add68130 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,11 +65,8 @@ jobs: - name: Install dependencies run: | - python setup.py install - # Used by ci_test.sh - pip install deepdiff + pip install ".[dev]" - pip install "solc-select>=v1.0.0b1" solc-select install all solc-select use 0.5.1 pip install typing_extensions==4.1.1 diff --git a/.github/workflows/detectors.yml b/.github/workflows/detectors.yml index 4d8109297..0745de802 100644 --- a/.github/workflows/detectors.yml +++ b/.github/workflows/detectors.yml @@ -33,14 +33,8 @@ jobs: - name: Install dependencies run: | + pip install ".[dev]" - python setup.py install - pip install deepdiff - pip install pytest==7.0.1 - pip install typing_extensions==4.1.1 - pip install importlib_metadata==4.8.3 - - pip install "solc-select>=v1.0.0b1" solc-select install all solc-select use 0.7.3 - name: Test with pytest diff --git a/.github/workflows/features.yml b/.github/workflows/features.yml index 3763faca0..d26a68980 100644 --- a/.github/workflows/features.yml +++ b/.github/workflows/features.yml @@ -33,14 +33,8 @@ jobs: - name: Install dependencies run: | + pip install ".[dev]" - python setup.py install - pip install deepdiff - pip install pytest==7.0.1 - pip install typing_extensions==4.1.1 - pip install importlib_metadata==4.8.3 - - pip install "solc-select>=v1.0.0b1" solc-select install all solc-select use 0.8.0 diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index c1b31a1c4..f3a66063e 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -29,9 +29,6 @@ jobs: - name: Install dependencies run: | - pip install . - pip install deepdiff numpy - mkdir -p .github/linters cp pyproject.toml .github/linters diff --git a/.github/workflows/parser.yml b/.github/workflows/parser.yml index 4c3566904..d3facfc79 100644 --- a/.github/workflows/parser.yml +++ b/.github/workflows/parser.yml @@ -33,13 +33,7 @@ jobs: - name: Install dependencies run: | - - python setup.py install - pip install deepdiff - pip install pytest==7.0.1 - pip install typing_extensions==4.1.1 - pip install importlib_metadata==4.8.3 - pip install "solc-select>=v1.0.0b1" + pip install ".[dev]" - name: Install solc run: | diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 692a981ab..199d1bea4 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -29,8 +29,8 @@ jobs: - name: Install dependencies run: | - pip install . - pip install deepdiff numpy + pip install ".[dev]" + pip install numpy mkdir -p .github/linters cp pyproject.toml .github/linters diff --git a/.github/workflows/read_storage.yml b/.github/workflows/read_storage.yml index 2ca618a19..b4c1d545d 100644 --- a/.github/workflows/read_storage.yml +++ b/.github/workflows/read_storage.yml @@ -35,11 +35,8 @@ jobs: - name: Install python dependencies run: | - python3 setup.py install - pip install web3 pytest deepdiff solc-select - pip install pytest==7.0.1 - pip install typing_extensions==4.1.1 - pip install importlib_metadata==4.8.3 + pip install ".[dev]" + pip install web3 solc-select install 0.8.1 solc-select install 0.8.10 solc-select use 0.8.1 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e93b2557c..75c470456 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,10 +23,7 @@ Some pull request guidelines: ## Development Environment Instructions for installing a development version of Slither can be found in our [wiki](https://github.com/crytic/slither/wiki/Developer-installation). -To run the unit tests, you need -- `deepdiff` installed (`pip install deepdiff`). -- `pycov` installed (`pip install pytest-cov`). -- [`solc-select`](https://github.com/crytic/solc-select) installed. +To run the unit tests, you need clone this repo and run `pip install ".[dev]"`. ### Linters diff --git a/README.md b/README.md index b160cd9be..4010448be 100644 --- a/README.md +++ b/README.md @@ -40,9 +40,12 @@ Run Slither on a single file: slither tests/uninitialized.sol ``` -For GitHub action integration, see [slither-action](https://github.com/marketplace/actions/slither-action). For additional configuration, see the [usage](https://github.com/trailofbits/slither/wiki/Usage) documentation. +### Integration +- For GitHub action integration, use [slither-action](https://github.com/marketplace/actions/slither-action). +- To generate a Markdown report, use `slither [target] --checklist`. +- To generate a Markdown with GitHub source code highlighting, use `slither [target] --checklist --markdown-root https://github.com/ORG/REPO/blob/COMMIT/` (replace `ORG`, `REPO`, `COMMIT`) -Use [solc-select](https://github.com/crytic/solc-select) if your contracts require older versions of solc. +Use [solc-select](https://github.com/crytic/solc-select) if your contracts require older versions of solc. For additional configuration, see the [usage](https://github.com/trailofbits/slither/wiki/Usage) documentation. ### Detectors diff --git a/setup.py b/setup.py index 1069f8aef..5a0548a24 100644 --- a/setup.py +++ b/setup.py @@ -17,6 +17,18 @@ setup( # "crytic-compile>=0.2.3", "crytic-compile", ], + extras_require={ + "dev": [ + "black>=22.3.0", + "pylint>=2.13.4", + "pytest==7.0.1", + "pytest-cov", + "deepdiff", + "typing_extensions==4.1.1", + "importlib_metadata==4.8.3", + "solc-select>=v1.0.0b1", + ] + }, dependency_links=["git+https://github.com/crytic/crytic-compile.git@master#egg=crytic-compile"], license="AGPL-3.0", long_description=long_description, diff --git a/slither/__main__.py b/slither/__main__.py index bc34e7081..dd195b65b 100644 --- a/slither/__main__.py +++ b/slither/__main__.py @@ -299,6 +299,9 @@ def parse_args(detector_classes, printer_classes): # pylint: disable=too-many-s group_detector = parser.add_argument_group("Detectors") group_printer = parser.add_argument_group("Printers") + group_checklist = parser.add_argument_group( + "Checklist (consider using https://github.com/crytic/slither-action)" + ) group_misc = parser.add_argument_group("Additional options") group_detector.add_argument( @@ -392,6 +395,28 @@ def parse_args(detector_classes, printer_classes): # pylint: disable=too-many-s default=defaults_flag_in_config["show_ignored_findings"], ) + group_checklist.add_argument( + "--checklist", + help="Generate a markdown page with the detector results", + action="store_true", + default=False, + ) + + group_checklist.add_argument( + "--checklist-limit", + help="Limite the number of results per detector in the markdown file", + action="store", + default="", + ) + + group_checklist.add_argument( + "--markdown-root", + type=check_and_sanitize_markdown_root, + help="URL for markdown generation", + action="store", + default="", + ) + group_misc.add_argument( "--json", help='Export the results as a JSON file ("--json -" to export to stdout)', @@ -429,14 +454,6 @@ def parse_args(detector_classes, printer_classes): # pylint: disable=too-many-s default=defaults_flag_in_config["zip_type"], ) - group_misc.add_argument( - "--markdown-root", - type=check_and_sanitize_markdown_root, - help="URL for markdown generation", - action="store", - default="", - ) - group_misc.add_argument( "--disable-color", help="Disable output colorization", @@ -487,12 +504,6 @@ def parse_args(detector_classes, printer_classes): # pylint: disable=too-many-s parser.add_argument("--markdown", help=argparse.SUPPRESS, action=OutputMarkdown, default=False) - group_misc.add_argument( - "--checklist", help=argparse.SUPPRESS, action="store_true", default=False - ) - - group_misc.add_argument("--checklist-limit", help=argparse.SUPPRESS, action="store", default="") - parser.add_argument( "--wiki-detectors", help=argparse.SUPPRESS, action=OutputWiki, default=False )