Skip to content
Open
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
37 changes: 37 additions & 0 deletions .github/workflows/solhint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Solidity Lint (solhint)

on:
pull_request:
branches: [ ${{ github.event.repository.default_branch || 'main' }} ]
push:
branches: [ ${{ github.event.repository.default_branch || 'main' }} ]

jobs:
solhint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

# Try local devDependency first; fallback to global install
- name: Install solhint
run: |
if [ -f package.json ]; then
npm ci || npm i
npx --yes solhint --version || npm i -D solhint
else
npm i -g solhint
fi

- name: Run solhint
run: |
if ls contracts/**/*.sol >/dev/null 2>&1; then
npx solhint 'contracts/**/*.sol' || solhint 'contracts/**/*.sol'
else
echo "No Solidity files under contracts/, skipping."
fi
17 changes: 4 additions & 13 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
{
"extends": "solhint:recommended",
"rules": {
"func-visibility": [
"warn",
{
"ignoreConstructors": true
}
],
"var-name-mixedcase": "off",
"custom-errors": "off",
"no-global-import": "off",
"reason-string": "off",
"no-inline-assembly": "off",
"immutable-vars-naming": "off",
"one-contract-per-file": "off"
"max-line-length": ["warn", 120],
"func-visibility": ["error", {"ignoreConstructors": true}],
"no-empty-blocks": "warn",
"compiler-version": ["error", "^0.8.0"]
}
}