Skip to content

Commit

Permalink
chore: add local slither script
Browse files Browse the repository at this point in the history
re #10
  • Loading branch information
sripwoud committed Aug 7, 2024
1 parent 8fb3d4c commit 63647f4
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 6 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"format": "prettier -c .",
"format:write": "prettier -w .",
"remove:stable-version-field": "ts-node scripts/remove-stable-version-field.ts ${0} && yarn format:write",
"postinstall": "husky && git config --local core.editor cat"
"lint": "yarn workspaces foreach -Ap run lint",
"postinstall": "husky && git config --local core.editor cat",
"slither": "./scripts/check-slither.sh && yarn workspaces foreach -Ap run slither"
},
"keywords": [
"solidity",
Expand Down
3 changes: 2 additions & 1 deletion packages/excubiae/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"test:report-gas": "REPORT_GAS=true hardhat test",
"test:coverage": "hardhat coverage",
"typechain": "hardhat typechain",
"lint": "solhint 'contracts/**/*.sol'"
"lint": "solhint 'contracts/**/*.sol'",
"slither": "slither . --include-paths contracts --exclude-dependencies --ignore-compile"
},
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^2.0.3",
Expand Down
3 changes: 2 additions & 1 deletion packages/imt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"test:report-gas": "REPORT_GAS=true hardhat test",
"test:coverage": "hardhat coverage",
"typechain": "hardhat typechain",
"lint": "solhint 'contracts/**/*.sol'"
"lint": "solhint 'contracts/**/*.sol'",
"slither": "slither . --include-paths contracts --exclude-dependencies --ignore-compile"
},
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^2.0.3",
Expand Down
3 changes: 2 additions & 1 deletion packages/lazy-imt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"test:report-gas": "REPORT_GAS=true hardhat test",
"test:coverage": "hardhat coverage",
"typechain": "hardhat typechain",
"lint": "solhint 'contracts/**/*.sol'"
"lint": "solhint 'contracts/**/*.sol'",
"slither": "slither . --include-paths contracts --exclude-dependencies --ignore-compile"
},
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^2.0.3",
Expand Down
3 changes: 2 additions & 1 deletion packages/lazytower/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"test:report-gas": "REPORT_GAS=true hardhat test",
"test:coverage": "hardhat coverage",
"typechain": "hardhat typechain",
"lint": "solhint 'contracts/**/*.sol'"
"lint": "solhint 'contracts/**/*.sol'",
"slither": "slither . --include-paths contracts --exclude-dependencies --ignore-compile"
},
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^2.0.3",
Expand Down
3 changes: 2 additions & 1 deletion packages/lean-imt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"test:report-gas": "REPORT_GAS=true hardhat test",
"test:coverage": "hardhat coverage",
"typechain": "hardhat typechain",
"lint": "solhint 'contracts/**/*.sol'"
"lint": "solhint 'contracts/**/*.sol'",
"slither": "slither . --include-paths contracts --exclude-dependencies --ignore-compile"
},
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^2.0.3",
Expand Down
19 changes: 19 additions & 0 deletions scripts/check-slither.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
set -eu

CYAN="\033[36m"
RED="\033[31m"
RESET="\033[0m"

log() {
printf "%b\n" "$1"
}

main() {
if ! command -v slither >/dev/null; then
log "${RED}error: slither is required but is not installed${RESET}.\nFollow instructions at ${CYAN}https://github.com/crytic/slither?tab=readme-ov-file#how-to-install${RESET} and try again."
exit 1
fi
}

main

0 comments on commit 63647f4

Please sign in to comment.