Skip to content

Commit 96d107c

Browse files
0xrusowsky0xKitsunezerosnacksDaniPopesgrandizzy
authored
feat(forge): forge lint (foundry-rs#10405)
* add lint cmd, variable lints * wip * wip * wip * wip * wip * wip * add keccak256 opt test * wip * wip * wip * wip * fix div before mul * update lint args * wip * update declare lints macro * update with_severity * configure linter * wip * update hash value * fix read in source * rayon * reorder lint declarations * clippy * add placeholder for additional lints * more placeholders * wip * wip * refactor into sol linter * impl Linter for SolidityLinter * fmt * wip * wip * refactor lints into SolLint enum * update lint trait * wip * wip * wip * wip * wip * update lint * update forge lint to use ProjectLinter * wip * include/exclude files from linting * linter output display note * configure with severity and description * fmt * implementing display * wip * wip * implement display for linter output, clippy fixes * add note to update colors * update linter output display * remove todos, clean up comments * clean up display * update med finding color * add optional help message * display help message * simplify lint args, make severity configurable * updating lints, update tests * add tests for info patterns, fix regex * remove function mixed case * doc comments * clippy * fmt * reorganize, crate level docs * fix info lints * Use Solar daignostics instead of `LinterOutput` (#6) * use solar diagnostics, remove unneeded types * update diagnostic emission * clippy * set track daignostics to false * display help message * set level according to severity * update descriptions to be more concise * removed LinterError from lint trait * early pass + tests * fix: fmt + clippy * fix: fmt + clippy * fix: fmt + clippy * fix: fmt + clippy * fix: feedback * fix: feedback * fix: regex Co-authored-by: zerosnacks <95942363+zerosnacks@users.noreply.github.com> * tests: cli integration * fix: broken test * fix: fmt Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> * style: naming Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> * style: fmt Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> * fix: use heck + individual lint macros + housekeeping * fix: single session with parallel linting per file * style: fix docs errors + typos * docs: ref to deleted field * fix: preprocessor regression + cargo.toml + default lint config tests * test(forge): solar test runner (#2) * style: clippy * typo Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> * fix: housekeeping * docs: linter docs for users + devs * docs: style * docs: style * clone lint testdata with lf * fix: out dir constructor * update toml * fix: merge conflicts * fix: cargo.lock merge conflicts * style: clippy * style: whitespace * fix: clippy * Cargo.lock update to weekly task * Preserve alloy patch placeholders * Clippy --------- Co-authored-by: 0xKitsune <0xkitsune@protonmail.com> Co-authored-by: 0xKitsune <77890308+0xKitsune@users.noreply.github.com> Co-authored-by: zerosnacks <95942363+zerosnacks@users.noreply.github.com> Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Co-authored-by: grandizzy <grandizzy.the.egg@gmail.com> Co-authored-by: grandizzy <38490174+grandizzy@users.noreply.github.com>
1 parent 4a7f84b commit 96d107c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2108
-5
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ testdata/cheats/Vm.sol linguist-generated
33

44
# See <https://git-scm.com/docs/gitattributes#_defining_a_custom_hunk_header>
55
*.rs diff=rust
6+
crates/lint/testdata/* text eol=lf

Cargo.lock

Lines changed: 159 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ members = [
2323
"crates/script-sequence/",
2424
"crates/macros/",
2525
"crates/test-utils/",
26+
"crates/lint/",
2627
]
2728
resolver = "2"
2829

@@ -173,6 +174,7 @@ forge = { path = "crates/forge" }
173174

174175
forge-doc = { path = "crates/doc" }
175176
forge-fmt = { path = "crates/fmt" }
177+
forge-lint = { path = "crates/lint" }
176178
forge-verify = { path = "crates/verify" }
177179
forge-script = { path = "crates/script" }
178180
forge-sol-macro-gen = { path = "crates/sol-macro-gen" }
@@ -200,7 +202,9 @@ foundry-block-explorers = { version = "0.17.0", default-features = false }
200202
foundry-compilers = { version = "0.16.1", default-features = false }
201203
foundry-fork-db = "0.14"
202204
solang-parser = { version = "=0.3.8", package = "foundry-solang-parser" }
205+
solar-ast = { version = "=0.1.3", default-features = false }
203206
solar-parse = { version = "=0.1.3", default-features = false }
207+
solar-interface = { version = "=0.1.3", default-features = false }
204208
solar-sema = { version = "=0.1.3", default-features = false }
205209

206210
## alloy
@@ -337,6 +341,7 @@ vergen = { version = "8", default-features = false }
337341
yansi = { version = "1.0", features = ["detect-tty", "detect-env"] }
338342
path-slash = "0.2"
339343
jiff = "0.2"
344+
heck = "0.5"
340345

341346
## Pinned dependencies. Enabled for the workspace in crates/test-utils.
342347

crates/anvil/core/src/eth/transaction/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1679,7 +1679,7 @@ mod tests {
16791679
fn deser_to_type_tx() {
16801680
let tx = r#"
16811681
{
1682-
"EIP1559": {
1682+
"EIP1559": {
16831683
"chainId": "0x7a69",
16841684
"nonce": "0x0",
16851685
"gas": "0x5209",

crates/config/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ alloy-primitives = { workspace = true, features = ["serde"] }
2323
revm.workspace = true
2424

2525
solar-parse.workspace = true
26+
solar-interface.workspace = true
2627

2728
dirs.workspace = true
2829
dunce.workspace = true
2930
eyre.workspace = true
3031
figment = { workspace = true, features = ["toml", "env"] }
3132
glob = "0.3"
3233
globset = "0.4"
33-
heck = "0.5"
34+
heck.workspace = true
3435
itertools.workspace = true
3536
mesc.workspace = true
3637
number_prefix = "0.4"
@@ -46,6 +47,7 @@ toml_edit = "0.22"
4647
tracing.workspace = true
4748
walkdir.workspace = true
4849
yansi.workspace = true
50+
clap = { version = "4", features = ["derive"] }
4951

5052
[target.'cfg(target_os = "windows")'.dependencies]
5153
path-slash = "0.2"

0 commit comments

Comments
 (0)