@@ -33,7 +33,7 @@ const OTHER_CONTRACT: &str = r#"
33
33
import { ContractWithLints } from "./ContractWithLints.sol";
34
34
35
35
contract OtherContractWithLints {
36
- uint256 VARIABLE_MIXED_CASE_INFO;
36
+ function functionMIXEDCaseInfo() public {}
37
37
}
38
38
"# ;
39
39
@@ -78,6 +78,7 @@ forgetest!(can_use_config, |prj, cmd| {
78
78
exclude_lints: vec![ "incorrect-shift" . into( ) ] ,
79
79
ignore: vec![ ] ,
80
80
lint_on_build: true ,
81
+ ..Default :: default ( )
81
82
} ;
82
83
} ) ;
83
84
cmd. arg( "lint" ) . assert_success( ) . stderr_eq( str ![ [ r#"
@@ -105,16 +106,17 @@ forgetest!(can_use_config_ignore, |prj, cmd| {
105
106
exclude_lints: vec![ ] ,
106
107
ignore: vec![ "src/ContractWithLints.sol" . into( ) ] ,
107
108
lint_on_build: true ,
109
+ ..Default :: default ( )
108
110
} ;
109
111
} ) ;
110
112
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
113
115
|
114
- 9 | uint256 VARIABLE_MIXED_CASE_INFO;
115
- | --- ---------------------
116
+ 9 | function functionMIXEDCaseInfo() public {}
117
+ | ---------------------
116
118
|
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
118
120
119
121
120
122
"# ] ] ) ;
@@ -126,6 +128,25 @@ note[mixed-case-variable]: mutable variables should use mixedCase
126
128
exclude_lints: vec![ ] ,
127
129
ignore: vec![ "src/ContractWithLints.sol" . into( ) , "src/OtherContract.sol" . into( ) ] ,
128
130
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( ) ] ,
129
150
} ;
130
151
} ) ;
131
152
cmd. arg( "lint" ) . assert_success( ) . stderr_eq( str ![ [ "" ] ] ) ;
@@ -143,16 +164,17 @@ forgetest!(can_override_config_severity, |prj, cmd| {
143
164
exclude_lints: vec![ ] ,
144
165
ignore: vec![ "src/ContractWithLints.sol" . into( ) ] ,
145
166
lint_on_build: true ,
167
+ ..Default :: default ( )
146
168
} ;
147
169
} ) ;
148
170
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
151
173
|
152
- 9 | uint256 VARIABLE_MIXED_CASE_INFO;
153
- | --- ---------------------
174
+ 9 | function functionMIXEDCaseInfo() public {}
175
+ | ---------------------
154
176
|
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
156
178
157
179
158
180
"# ] ] ) ;
@@ -170,6 +192,7 @@ forgetest!(can_override_config_path, |prj, cmd| {
170
192
exclude_lints: vec![ "incorrect-shift" . into( ) ] ,
171
193
ignore: vec![ "src/ContractWithLints.sol" . into( ) ] ,
172
194
lint_on_build: true ,
195
+ ..Default :: default ( )
173
196
} ;
174
197
} ) ;
175
198
cmd. arg( "lint" ) . arg( "src/ContractWithLints.sol" ) . assert_success( ) . stderr_eq( str ![ [ r#"
@@ -197,6 +220,7 @@ forgetest!(can_override_config_lint, |prj, cmd| {
197
220
exclude_lints: vec![ "incorrect-shift" . into( ) ] ,
198
221
ignore: vec![ ] ,
199
222
lint_on_build: true ,
223
+ ..Default :: default ( )
200
224
} ;
201
225
} ) ;
202
226
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| {
225
249
exclude_lints: vec![ "incorrect-shift" . into( ) ] ,
226
250
ignore: vec![ ] ,
227
251
lint_on_build: true ,
252
+ ..Default :: default ( )
228
253
} ;
229
254
} ) ;
230
255
@@ -288,6 +313,7 @@ forgetest!(build_respects_quiet_flag_for_linting, |prj, cmd| {
288
313
exclude_lints: vec![ "incorrect-shift" . into( ) ] ,
289
314
ignore: vec![ ] ,
290
315
lint_on_build: true ,
316
+ ..Default :: default ( )
291
317
} ;
292
318
} ) ;
293
319
@@ -306,6 +332,7 @@ forgetest!(build_with_json_uses_json_linter_output, |prj, cmd| {
306
332
exclude_lints: vec![ "incorrect-shift" . into( ) ] ,
307
333
ignore: vec![ ] ,
308
334
lint_on_build: true ,
335
+ ..Default :: default ( )
309
336
} ;
310
337
} ) ;
311
338
@@ -334,6 +361,7 @@ forgetest!(build_respects_lint_on_build_false, |prj, cmd| {
334
361
exclude_lints: vec![ "incorrect-shift" . into( ) ] ,
335
362
ignore: vec![ ] ,
336
363
lint_on_build: false ,
364
+ ..Default :: default ( )
337
365
} ;
338
366
} ) ;
339
367
0 commit comments