Skip to content

Commit

Permalink
chore: check formatting on CI (#161)
Browse files Browse the repository at this point in the history
## Description

New GitHub action that enforces `forge fmt` formatting for files outside
of `src/`.
No changes to source files were needed.

## Test Plan

CI. Try to break formatting locally and see that `forge fmt --check`
catches that as long as it's not in `src/`.
  • Loading branch information
fedgiac authored Jun 7, 2024
1 parent febcea2 commit b4d64fd
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 7 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Lint

on:
workflow_dispatch:
pull_request:
paths:
- '**.sol'
push:
branches:
- main
paths:
- '**.sol'

env:
FOUNDRY_PROFILE: ci

jobs:
lint:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Check Forge fmt
run: forge fmt --check
id: format
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
"editor.defaultFormatter": "JuanBlanco.solidity"
},
"solidity.compileUsingRemoteVersion": "v0.7.6+commit.7338295f",
"solidity.formatter": "forge"
}
7 changes: 7 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ libs = ["node_modules", "lib"]
via_ir = false
optimizer = true
optimizer_runs = 1000000

[fmt]
ignore = [
# We don't want to change the formatting of our main contracts until the
# migration to Foundry is concluded.
"src/contracts/**/*"
]
7 changes: 0 additions & 7 deletions test/TestNoOp.sol

This file was deleted.

0 comments on commit b4d64fd

Please sign in to comment.