@@ -33,7 +33,7 @@ const OTHER_CONTRACT: &str = r#"
3333 import { ContractWithLints } from "./ContractWithLints.sol";
3434
3535 contract OtherContractWithLints {
36- uint256 VARIABLE_MIXED_CASE_INFO;
36+ function functionMIXEDCaseInfo() public {}
3737 }
3838 "# ;
3939
@@ -78,6 +78,7 @@ forgetest!(can_use_config, |prj, cmd| {
7878 exclude_lints: vec![ "incorrect-shift" . into( ) ] ,
7979 ignore: vec![ ] ,
8080 lint_on_build: true ,
81+ ..Default :: default ( )
8182 } ;
8283 } ) ;
8384 cmd. arg( "lint" ) . assert_success( ) . stderr_eq( str ![ [ r#"
@@ -105,16 +106,17 @@ forgetest!(can_use_config_ignore, |prj, cmd| {
105106 exclude_lints: vec![ ] ,
106107 ignore: vec![ "src/ContractWithLints.sol" . into( ) ] ,
107108 lint_on_build: true ,
109+ ..Default :: default ( )
108110 } ;
109111 } ) ;
110112 cmd. arg( "lint" ) . assert_success( ) . stderr_eq( str ![ [ r#"
111- note[mixed-case-variable ]: mutable variables should use mixedCase
112- [FILE]:9:17
113+ note[mixed-case-function ]: function names should use mixedCase
114+ [FILE]:9:18
113115 |
114- 9 | uint256 VARIABLE_MIXED_CASE_INFO;
115- | --- ---------------------
116+ 9 | function functionMIXEDCaseInfo() public {}
117+ | ---------------------
116118 |
117- = help: https://book.getfoundry.sh/reference/forge/forge-lint#mixed-case-variable
119+ = help: https://book.getfoundry.sh/reference/forge/forge-lint#mixed-case-function
118120
119121
120122"# ] ] ) ;
@@ -126,6 +128,25 @@ note[mixed-case-variable]: mutable variables should use mixedCase
126128 exclude_lints: vec![ ] ,
127129 ignore: vec![ "src/ContractWithLints.sol" . into( ) , "src/OtherContract.sol" . into( ) ] ,
128130 lint_on_build: true ,
131+ ..Default :: default ( )
132+ } ;
133+ } ) ;
134+ cmd. arg( "lint" ) . assert_success( ) . stderr_eq( str ![ [ "" ] ] ) ;
135+ } ) ;
136+
137+ forgetest ! ( can_use_config_mixed_case_exception, |prj, cmd| {
138+ prj. wipe_contracts( ) ;
139+ prj. add_source( "ContractWithLints" , CONTRACT ) . unwrap( ) ;
140+ prj. add_source( "OtherContract" , OTHER_CONTRACT ) . unwrap( ) ;
141+
142+ // Check config for `ignore`
143+ prj. update_config( |config| {
144+ config. lint = LinterConfig {
145+ severity: vec![ ] ,
146+ exclude_lints: vec![ ] ,
147+ ignore: vec![ "src/ContractWithLints.sol" . into( ) ] ,
148+ lint_on_build: true ,
149+ mixed_case_exceptions: vec![ "MIXED" . to_string( ) ] ,
129150 } ;
130151 } ) ;
131152 cmd. arg( "lint" ) . assert_success( ) . stderr_eq( str ![ [ "" ] ] ) ;
@@ -143,16 +164,17 @@ forgetest!(can_override_config_severity, |prj, cmd| {
143164 exclude_lints: vec![ ] ,
144165 ignore: vec![ "src/ContractWithLints.sol" . into( ) ] ,
145166 lint_on_build: true ,
167+ ..Default :: default ( )
146168 } ;
147169 } ) ;
148170 cmd. arg( "lint" ) . args( [ "--severity" , "info" ] ) . assert_success( ) . stderr_eq( str ![ [ r#"
149- note[mixed-case-variable ]: mutable variables should use mixedCase
150- [FILE]:9:17
171+ note[mixed-case-function ]: function names should use mixedCase
172+ [FILE]:9:18
151173 |
152- 9 | uint256 VARIABLE_MIXED_CASE_INFO;
153- | --- ---------------------
174+ 9 | function functionMIXEDCaseInfo() public {}
175+ | ---------------------
154176 |
155- = help: https://book.getfoundry.sh/reference/forge/forge-lint#mixed-case-variable
177+ = help: https://book.getfoundry.sh/reference/forge/forge-lint#mixed-case-function
156178
157179
158180"# ] ] ) ;
@@ -170,6 +192,7 @@ forgetest!(can_override_config_path, |prj, cmd| {
170192 exclude_lints: vec![ "incorrect-shift" . into( ) ] ,
171193 ignore: vec![ "src/ContractWithLints.sol" . into( ) ] ,
172194 lint_on_build: true ,
195+ ..Default :: default ( )
173196 } ;
174197 } ) ;
175198 cmd. arg( "lint" ) . arg( "src/ContractWithLints.sol" ) . assert_success( ) . stderr_eq( str ![ [ r#"
@@ -197,6 +220,7 @@ forgetest!(can_override_config_lint, |prj, cmd| {
197220 exclude_lints: vec![ "incorrect-shift" . into( ) ] ,
198221 ignore: vec![ ] ,
199222 lint_on_build: true ,
223+ ..Default :: default ( )
200224 } ;
201225 } ) ;
202226 cmd. arg( "lint" ) . args( [ "--only-lint" , "incorrect-shift" ] ) . assert_success( ) . stderr_eq( str ![ [
@@ -225,6 +249,7 @@ forgetest!(build_runs_linter_by_default, |prj, cmd| {
225249 exclude_lints: vec![ "incorrect-shift" . into( ) ] ,
226250 ignore: vec![ ] ,
227251 lint_on_build: true ,
252+ ..Default :: default ( )
228253 } ;
229254 } ) ;
230255
@@ -288,6 +313,7 @@ forgetest!(build_respects_quiet_flag_for_linting, |prj, cmd| {
288313 exclude_lints: vec![ "incorrect-shift" . into( ) ] ,
289314 ignore: vec![ ] ,
290315 lint_on_build: true ,
316+ ..Default :: default ( )
291317 } ;
292318 } ) ;
293319
@@ -306,6 +332,7 @@ forgetest!(build_with_json_uses_json_linter_output, |prj, cmd| {
306332 exclude_lints: vec![ "incorrect-shift" . into( ) ] ,
307333 ignore: vec![ ] ,
308334 lint_on_build: true ,
335+ ..Default :: default ( )
309336 } ;
310337 } ) ;
311338
@@ -334,6 +361,7 @@ forgetest!(build_respects_lint_on_build_false, |prj, cmd| {
334361 exclude_lints: vec![ "incorrect-shift" . into( ) ] ,
335362 ignore: vec![ ] ,
336363 lint_on_build: false ,
364+ ..Default :: default ( )
337365 } ;
338366 } ) ;
339367
0 commit comments