Skip to content

Commit

Permalink
Merge pull request #34 from bitmark-inc/ci/linter
Browse files Browse the repository at this point in the history
ci: add linter for solidity
  • Loading branch information
anhnguyenbitmark authored Feb 28, 2024
2 parents 5f9fde0 + 4090858 commit 2b87afa
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Solidity Lint

on: [pull_request]

jobs:
solidity-lint:
name: Lint Solidity
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: '18'

- name: Install Solhint
run: npm install -g solhint

- name: Run Solhint
run: solhint -f sarif 'contracts/**/*.sol' > solhint-report.txt
continue-on-error: true

- name: Install Reviewdog
uses: reviewdog/action-setup@v1

- name: Run Reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
reviewdog -f=sarif -name="solhint" -reporter=github-pr-review -filter-mode=added < solhint-report.txt
3 changes: 3 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "solhint:recommended"
}

0 comments on commit 2b87afa

Please sign in to comment.