Skip to content

Commit

Permalink
update slither instructions (#1043)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xalpharush authored Nov 17, 2023
1 parent 2b4f80d commit af7d8c7
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions src/config/static-analyzers.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,23 @@ To test your project using [slither](https://github.com/crytic/slither), here is
}
```

To run Slither on the entire project, you can use this command:
To run Slither on the entire project, use this command in the root of the project:

```sh
slither .
```

You do not need to provide remappings via the `solc_remaps` option as Slither will automatically detect remappings in a Foundry project. Slither will invoke `forge` to perform the build.
By default (as of version 0.10.0), this will skip tests and scripts. To force inclusion of the tests and scripts, add the `--foundry-compile-all` flag.

However, if you want to analyze a specific `.sol` file, then you do need to provide remappings:
To run Slither on a single file, use this command:

```json
{
"solc_remaps": [
"ds-test/=lib/ds-test/src/",
"forge-std/=lib/forge-std/src/"
]
}
```sh
slither src/Contract.sol
```

And you also need to update the `solc` compiler used by Slither to the same version used by Forge with `solc-select`:
Note, this requires configuring the [solc version in the foundry config file](https://book.getfoundry.sh/reference/config/solidity-compiler#solc_version).

```sh
pip3 install slither-analyzer
pip3 install solc-select
solc-select install 0.8.13
solc-select use 0.8.13
slither .
```
You do not need to provide remappings via the `solc_remaps` option as Slither will automatically detect remappings in a Foundry project. Slither will invoke `forge` to perform the build.

See the [Slither wiki](https://github.com/crytic/slither/wiki/Usage) for more information.

Expand Down

0 comments on commit af7d8c7

Please sign in to comment.