-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Component
Forge
Have you ensured that all of these are up to date?
- Foundry
- Foundryup
What version of Foundry are you on?
forge Version: 1.5.0-stable
What version of Foundryup are you on?
foundryup: 1.4.0
What command(s) is the bug in?
forge lint
Operating System
macOS (Apple Silicon)
Describe the bug
Summary
forge lint (which uses solar internally) does not respect the [lint] ignore configuration when compiling files. The ignore field only prevents linting of specified files, but solar still attempts to compile them to check for compilation errors, causing the command to fail even when files are explicitly ignored.
Environment
- Foundry Version:
forge 1.5.0-stable(Commit:1c57854462289b2e71ee7654cd6666217ed86ffd) - Build Timestamp:
2025-11-26T09:16:58.269730000Z - Build Profile:
maxperf - OS: macOS (darwin 24.6.0)
Steps to Reproduce
- Configure
foundry.tomlwith[lint] ignoreto exclude files from a dependency:
[lint]
ignore = ["lib/**"]-
Have a dependency in
lib/that contains Solidity files with imports that don't resolve correctly from the parent project's context (e.g., test files using relative imports that only work within the dependency's own build context). -
Run
forge lint:
forge lintExpected Behavior
When [lint] ignore = ["lib/**"] is configured, forge lint should:
- Skip compilation of files matching the ignore pattern
- Skip linting of files matching the ignore pattern
- Complete successfully without errors related to ignored files
Actual Behavior
forge lint correctly and successfully compiles the project as configured, but then solar fails with compilation errors from ignored files:
> forge lint
Compiling 1 files with Solc 0.8.30
Solc 0.8.30 finished in 684.94ms
Compiler run successful!
error: file src/interfaces/IEmissary.sol not found
--> lib/the-compact/src/test/AlwaysOKEmissary.sol:4:27
|
4 | import { IEmissary } from "src/interfaces/IEmissary.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: solar run failed
In the above example, the src/interfaces/IEmissary.sol file indeed exists at the expected location (lib/the-compact/src/interfaces/IEmissary.sol), and both the project and the dependency itself compile just fine. However, solar improperly handles the resolution of the dependency's import statements because it appears to ignore the compilation configuration specified in foundry.toml.
The ignore configuration only prevents linting, but solar still compiles all discovered files (including those in lib/) before linting them. This causes the command to fail during the compilation phase, before it even reaches the linting phase where the ignore configuration would apply.
Notes and Suggested Fix
The issue occurs because solar compiles files to check for compilation errors before linting them. This compilation step happens before the ignore configuration is applied, which only affects the linting phase. The skip field in foundry.toml works for forge build but is not respected by forge lint or solar.
solar (or rather forge lint's integration with solar) should respect the [lint] ignore (and other relevant fields such as skip in the compilation profile) configuration during the compilation phase. Files matching the ignore pattern should be excluded completely from discovery, compilation and linting.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status