@@ -48,6 +48,24 @@ const ONLY_IMPORTS: &str = r#"
4848 import "./ContractWithLints.sol";
4949 "# ;
5050
51+ const COUNTER_A : & str = r#"
52+ // SPDX-License-Identifier: MIT
53+ pragma solidity ^0.8.0;
54+
55+ contract CounterA {
56+ uint256 public CounterA_Fail_Lint;
57+ }
58+ "# ;
59+
60+ const COUNTER_B : & str = r#"
61+ // SPDX-License-Identifier: MIT
62+ pragma solidity ^0.8.0;
63+
64+ contract CounterB {
65+ uint256 public CounterB_Fail_Lint;
66+ }
67+ "# ;
68+
5169forgetest ! ( can_use_config, |prj, cmd| {
5270 prj. wipe_contracts( ) ;
5371 prj. add_source( "ContractWithLints" , CONTRACT ) . unwrap( ) ;
@@ -388,6 +406,48 @@ note[unused-import]: unused imports should be removed
388406"# ] ] ) ;
389407} ) ;
390408
409+ // <https://github.com/foundry-rs/foundry/issues/11234>
410+ forgetest ! ( can_lint_only_built_files, |prj, cmd| {
411+ prj. wipe_contracts( ) ;
412+ prj. add_source( "CounterAWithLints" , COUNTER_A ) . unwrap( ) ;
413+ prj. add_source( "CounterBWithLints" , COUNTER_B ) . unwrap( ) ;
414+
415+ // Both contracts should be linted on build.
416+ cmd. forge_fuse( ) . args( [ "build" ] ) . assert_success( ) . stderr_eq( str ![ [ r#"
417+ note[mixed-case-variable]: mutable variables should use mixedCase
418+ [FILE]:6:24
419+ |
420+ 6 | uint256 public CounterA_Fail_Lint;
421+ | ------------------
422+ |
423+ = help: https://book.getfoundry.sh/reference/forge/forge-lint#mixed-case-variable
424+
425+ note[mixed-case-variable]: mutable variables should use mixedCase
426+ [FILE]:6:24
427+ |
428+ 6 | uint256 public CounterB_Fail_Lint;
429+ | ------------------
430+ |
431+ = help: https://book.getfoundry.sh/reference/forge/forge-lint#mixed-case-variable
432+
433+
434+ "# ] ] ) ;
435+ // Only contract CounterBWithLints that we build should be linted.
436+ cmd. forge_fuse( ) . args( [ "build" , "src/CounterBWithLints.sol" ] ) . assert_success( ) . stderr_eq( str ![
437+ [ r#"
438+ note[mixed-case-variable]: mutable variables should use mixedCase
439+ [FILE]:6:24
440+ |
441+ 6 | uint256 public CounterB_Fail_Lint;
442+ | ------------------
443+ |
444+ = help: https://book.getfoundry.sh/reference/forge/forge-lint#mixed-case-variable
445+
446+
447+ "# ]
448+ ] ) ;
449+ } ) ;
450+
391451// ------------------------------------------------------------------------------------------------
392452
393453#[ tokio:: test]
0 commit comments