Skip to content

Commit b8ab12e

Browse files
grandizzyMerkleBoy
authored andcommitted
fix(lint): account codesize registered lints (foundry-rs#11228)
* fix(lint): account codesize registered lints * test
1 parent ba2f28d commit b8ab12e

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

crates/forge/tests/cli/config.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,3 +1847,20 @@ contract Counter {
18471847
assert_eq!("true", enabled.unwrap().to_string());
18481848
assert_eq!("800", runs.unwrap().to_string());
18491849
});
1850+
1851+
// <https://github.com/foundry-rs/foundry/issues/11227>
1852+
forgetest_init!(test_exclude_lints_config, |prj, cmd| {
1853+
prj.update_config(|config| {
1854+
config.lint.exclude_lints = vec![
1855+
"asm-keccak256".to_string(),
1856+
"incorrect-shift".to_string(),
1857+
"divide-before-multiply".to_string(),
1858+
"mixed-case-variable".to_string(),
1859+
"mixed-case-function".to_string(),
1860+
"screaming-snake-case-const".to_string(),
1861+
"screaming-snake-case-immutable".to_string(),
1862+
"unwrapped-modifier-logic".to_string(),
1863+
]
1864+
});
1865+
cmd.args(["lint"]).assert_success().stdout_eq(str![""]);
1866+
});

crates/lint/src/sol/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,12 @@ impl<'a> TryFrom<&'a str> for SolLint {
370370
}
371371
}
372372

373+
for &lint in codesize::REGISTERED_LINTS {
374+
if lint.id() == value {
375+
return Ok(lint);
376+
}
377+
}
378+
373379
Err(SolLintError::InvalidId(value.to_string()))
374380
}
375381
}

0 commit comments

Comments
 (0)