Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(CI/CD): fix solhint #190

Merged
merged 3 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 14 additions & 21 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ repos:
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
- id: detect-secrets
args: ["--baseline", ".secrets.baseline"]
exclude: "(pnpm-lock.yaml|testdata|static|config.json|genesis.json)"

# Then run code formatters
Expand All @@ -27,16 +27,16 @@ repos:
- id: go-mod-tidy # Run go mod tidy when go.mod changes
files: go.mod
- id: go-fmt
args: [ -w, -s ] # simplify code and write result to (source) file instead of stdout
args: [-w, -s] # simplify code and write result to (source) file instead of stdout

- repo: local
hooks:
- id: run-solidity-lint
name: run-solidity-lint
language: script
entry: .pre-commit/run_solidity_lint.sh
types: [ file, solidity ]
require_serial: true
- id: run-solidity-lint
name: run-solidity-lint
language: script
entry: .pre-commit/run_solidity_lint.sh
types: [file, solidity]
require_serial: true

# Then run code validators (on the formatted code)

Expand All @@ -54,40 +54,33 @@ repos:
name: run-buf
language: script
entry: .pre-commit/run_buf.sh
types: [ file, proto ]
types: [file, proto]
pass_filenames: false

- id: run-go-tests
name: run-go-tests
language: script
require_serial: true # Don't run this in parallel
entry: .pre-commit/run_go_tests.sh
types: [ file, go ]
types: [file, go]

- id: run-forge-tests
name: run-forge-tests
language: script
entry: .pre-commit/run_forge_tests.sh
types: [ file, solidity ]
types: [file, solidity]
require_serial: true

- id: run-regexp
name: run-regexp
language: script
entry: .pre-commit/run_regexp.sh
types: [ file, go ]
types: [file, go]
exclude: "(_test.go|contracts/bindings/.*|scripts/)"

- id: run-goversion
name: run-goversion
language: script
entry: .pre-commit/run_goversion.sh
pass_filenames: false
types: [ file, go ]

- id: run-solhint
name: run-solhint
language: script
entry: .pre-commit/run_solhint.sh
types: [ file, solidity ]
require_serial: true
types: [file, go]
13 changes: 0 additions & 13 deletions .pre-commit/run_solhint.sh

This file was deleted.

14 changes: 6 additions & 8 deletions .pre-commit/run_solidity_lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
# Runs `pnpm lint-check` for every unique foundry project derived from the list
# of files provided as arguments by pre-commit.

# TODO: Unify and fix solhint versions in repo
# source scripts/install_foundry.sh
source scripts/install_foundry.sh

# import foundryroots
# source .pre-commit/foundry_utils.sh
source .pre-commit/foundry_utils.sh

# for dir in $(foundryroots $@); do
# echo "Running 'lint-check' in ./$dir"
# (cd $dir && pnpm lint-check)
# done
for dir in $(foundryroots $@); do
echo "Running 'lint-fix and lint-full' in ./$dir"
(cd $dir && pnpm lint-fix && pnpm lint-full)
done
12 changes: 0 additions & 12 deletions .solhint.json

This file was deleted.

1 change: 0 additions & 1 deletion .solhintignore

This file was deleted.

3 changes: 1 addition & 2 deletions contracts/.solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"private-vars-leading-underscore": "off",
"func-name-mixedcase": "off",
"var-name-mixedcase": "off",
"modifier-name-mixedcase": "off",
"custom-errors": "off"
"modifier-name-mixedcase": "off"
}
}
11 changes: 5 additions & 6 deletions contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
],
"scripts": {
"test": "pnpm test:gen && forge test",
"lint-full": "prettier --log-level warn --ignore-path .gitignore '{contracts,test}/**/*.sol' --check && solhint '{contracts,test}/**/*.sol'",
"lint-fix": "prettier --log-level warn --ignore-path .gitignore '{contracts,test}/**/*.sol' --write",
"lint-check": "solhint '{contracts,script,test}/**/*.sol'"
"lint-full": "prettier --log-level warn --ignore-path .gitignore '{src,test,script}/**/*.sol' --check && solhint '{src,test,script}/**/*.sol'",
"lint-fix": "prettier --log-level warn --ignore-path .gitignore '{src,test,script}/**/*.sol' --write",
"lint-check": "solhint '{src,test,script}/**/*.sol'"
},
"devDependencies": {
"@openzeppelin/merkle-tree": "^1.0.5",
Expand All @@ -23,9 +23,8 @@
"ethereum-cryptography": "^2.1.3",
"forge-std": "https://github.com/foundry-rs/forge-std",
"prettier": "^3.3.3",
"prettier-plugin-solidity": "^1.3.1",
"solhint": "^5.0.1",
"solhint-community": "^4.0.0",
"prettier-plugin-solidity": "^1.4.1",
"solhint": "^5.0.3",
"solhint-plugin-prettier": "^0.1.0",
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
Expand Down
Loading
Loading