Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
f4e260c
feat: add example support for lints
0xrusowsky Jun 25, 2025
0dd20b2
bump solar
0xrusowsky Jun 25, 2025
0984def
style: clickable links
0xrusowsky Jun 25, 2025
714f023
wip: dynamic code diffs
0xrusowsky Jun 26, 2025
3f2032a
style
0xrusowsky Jun 26, 2025
7007965
Merge branch 'master' into rusowsky/lints-with-examples
0xrusowsky Jun 26, 2025
a8a2de9
Merge branch 'master' of github.com:foundry-rs/foundry into rusowsky/…
0xrusowsky Jul 2, 2025
41db76f
wip: setup `LateLintPass`
0xrusowsky Jul 7, 2025
42cecbc
wip: late lint pass
0xrusowsky Jul 8, 2025
2c4b0ad
fix: parse inline config with all lints
0xrusowsky Jul 8, 2025
a3cc0b2
ui runner: parse contract deps
0xrusowsky Jul 8, 2025
bfd30a0
Merge branch 'rusowsky/lints-with-examples' of github.com:foundry-rs/…
0xrusowsky Jul 8, 2025
0349846
dynamic assembly using HIR
0xrusowsky Jul 8, 2025
b956eb3
style: clippy
0xrusowsky Jul 9, 2025
489418c
Merge branch 'master' of github.com:foundry-rs/foundry into rusowsky/…
0xrusowsky Jul 9, 2025
d664249
style: cleanup + update blessed files
0xrusowsky Jul 9, 2025
39b37e3
Merge branch 'master' into rusowsky/lints-with-examples
0xrusowsky Jul 9, 2025
fee148d
style: cleanup
0xrusowsky Jul 9, 2025
8e10136
Merge branch 'rusowsky/lints-with-examples' of github.com:foundry-rs/…
0xrusowsky Jul 9, 2025
0ea9675
fix: peel type conversions `bytes32(c)` -> `c`
0xrusowsky Jul 9, 2025
68d287b
style: let chains 🙂
0xrusowsky Jul 9, 2025
308a1e1
fix: failing test
0xrusowsky Jul 9, 2025
7603363
Merge branch 'master' into rusowsky/lints-with-examples
0xrusowsky Jul 9, 2025
6475290
style: clippy
0xrusowsky Jul 9, 2025
6505894
Merge branch 'rusowsky/lints-with-examples' of github.com:foundry-rs/…
0xrusowsky Jul 9, 2025
9da8d84
docs: update dev docs
0xrusowsky Jul 9, 2025
e253cb3
fix: forge build integration
0xrusowsky Jul 9, 2025
e2f9fa6
fix: don't rmv artifacts on solar_pcx_from_build_opts
0xrusowsky Jul 10, 2025
1d49407
style: PR feedback
0xrusowsky Jul 10, 2025
7b3703a
docs: helper fns
0xrusowsky Jul 10, 2025
31922be
fix: rmv redundant `fn get_var_type`
0xrusowsky Jul 10, 2025
c453ae7
fix: ignore forge-std lib
0xrusowsky Jul 10, 2025
636334e
fix: ignore libs
0xrusowsky Jul 10, 2025
eed716a
Merge branch 'master' into rusowsky/lints-with-examples
grandizzy Jul 10, 2025
05b2a07
fix: don't lint all prjct source when using HIR
0xrusowsky Jul 10, 2025
f63a704
Merge branch 'rusowsky/lints-with-examples' of github.com:foundry-rs/…
0xrusowsky Jul 10, 2025
6d3ec60
fix: don't lint all project sources when using AST
0xrusowsky Jul 10, 2025
d6c729c
fix: use pcx for early lints
0xrusowsky Jul 10, 2025
5aaafb4
fix: revert manual imports ui runner + use `aux/` for deps + expand
0xrusowsky Jul 11, 2025
f388ec1
Merge branch 'master' into rusowsky/lints-with-examples
0xrusowsky Jul 11, 2025
30f01d1
fix: source filter
0xrusowsky Jul 11, 2025
fa197e1
Merge branch 'rusowsky/lints-with-examples' of github.com:foundry-rs/…
0xrusowsky Jul 11, 2025
ed4aa63
style: clippy + docs
0xrusowsky Jul 11, 2025
2559d25
fix(asm): clean args when loading them to memory
0xrusowsky Jul 15, 2025
a10f03b
Merge branch 'master' of github.com:foundry-rs/foundry into rusowsky/…
0xrusowsky Jul 15, 2025
d1b40a5
chore: temporarily disable assembly
0xrusowsky Jul 15, 2025
f7d3bb6
Merge branch 'master' into rusowsky/lints-with-examples
0xrusowsky Jul 15, 2025
2629815
style: clippy
0xrusowsky Jul 15, 2025
602b95b
Merge branch 'master' of github.com:foundry-rs/foundry into rusowsky/…
0xrusowsky Jul 15, 2025
6e00450
Merge branch 'rusowsky/lints-with-examples' of github.com:foundry-rs/…
0xrusowsky Jul 15, 2025
2df9cb3
fix: block-explorers patch
0xrusowsky Jul 15, 2025
1fcb45c
fix: remove todos
0xrusowsky Jul 15, 2025
b9e6e5a
Merge branch 'master' into rusowsky/lints-with-examples
grandizzy Jul 16, 2025
0d7971c
refactor: early.rs + late.rs
0xrusowsky Jul 16, 2025
16e8a6d
Merge branch 'master' of github.com:foundry-rs/foundry into rusowsky/…
0xrusowsky Jul 16, 2025
e14feb4
fix: failing test
0xrusowsky Jul 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 47 additions & 42 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,15 @@ foundry-wallets = { path = "crates/wallets" }
foundry-linking = { path = "crates/linking" }

# solc & compilation utilities
foundry-block-explorers = { version = "0.19.1", default-features = false }
foundry-compilers = { version = "0.17.4", default-features = false }
foundry-block-explorers = { version = "0.20.0", default-features = false }
foundry-compilers = { version = "0.18.0", default-features = false }
foundry-fork-db = "0.16"
solang-parser = { version = "=0.3.9", package = "foundry-solang-parser" }
solar-ast = { version = "=0.1.4", default-features = false }
solar-parse = { version = "=0.1.4", default-features = false }
solar-interface = { version = "=0.1.4", default-features = false }
solar-sema = { version = "=0.1.4", default-features = false }
solar-data-structures = { version = "=0.1.4", default-features = false }
solar-ast = { version = "=0.1.5", default-features = false }
solar-parse = { version = "=0.1.5", default-features = false }
solar-interface = { version = "=0.1.5", default-features = false }
solar-sema = { version = "=0.1.5", default-features = false }
solar-data-structures = { version = "=0.1.5", default-features = false }

## alloy
alloy-consensus = { version = "1.0.22", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion crates/chisel/src/solidity_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl SolidityHelper {
errored: false,
do_paint: yansi::is_enabled(),
sess: Session::builder().with_silent_emitter(None).build(),
globals: SessionGlobals::new(),
globals: SessionGlobals::default(),
}
}

Expand Down
17 changes: 11 additions & 6 deletions crates/cli/src/opts/build/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,27 @@ use std::path::PathBuf;
///
/// * Configures include paths, remappings and registers all in-memory sources so that solar can
/// operate without touching disk.
/// * If no `project` is provided, it will spin up a new ephemeral project.
/// * If no `target_paths` are provided, all project files are processed.
/// * Only processes the subset of sources with the most up-to-date Solitidy version.
pub fn solar_pcx_from_build_opts<'sess>(
sess: &'sess Session,
build: BuildOpts,
target_paths: Option<Vec<PathBuf>>,
build: &BuildOpts,
project: Option<&Project>,
target_paths: Option<&[PathBuf]>,
) -> Result<ParsingContext<'sess>> {
// Process build options
let config = build.load_config()?;
let project = config.ephemeral_project()?;
let project = match project {
Some(project) => project,
None => &config.ephemeral_project()?,
};

let sources = match target_paths {
// If target files are provided, only process those sources
Some(targets) => {
let mut sources = Sources::new();
for t in targets.into_iter() {
for t in targets {
let path = dunce::canonicalize(t)?;
let source = Source::read(&path)?;
sources.insert(path, source);
Expand All @@ -44,7 +49,7 @@ pub fn solar_pcx_from_build_opts<'sess>(
let graph = Graph::<MultiCompilerParsedSource>::resolve_sources(&project.paths, sources)?;
let (version, sources, _) = graph
// resolve graph into mapping language -> version -> sources
.into_sources_by_version(&project)?
.into_sources_by_version(project)?
.sources
.into_iter()
// only interested in Solidity sources
Expand All @@ -63,7 +68,7 @@ pub fn solar_pcx_from_build_opts<'sess>(
version,
);

Ok(solar_pcx_from_solc_project(sess, &project, &solc, true))
Ok(solar_pcx_from_solc_project(sess, project, &solc, true))
}

/// Builds a Solar [`solar_sema::ParsingContext`] from a [`foundry_compilers::Project`] and a
Expand Down
37 changes: 30 additions & 7 deletions crates/forge/src/cmd/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ use clap::Parser;
use eyre::Result;
use forge_lint::{linter::Linter, sol::SolidityLinter};
use foundry_cli::{
opts::BuildOpts,
opts::{BuildOpts, solar_pcx_from_build_opts},
utils::{LoadConfig, cache_local_signatures},
};
use foundry_common::{compile::ProjectCompiler, shell};
use foundry_compilers::{
Project, ProjectCompileOutput,
CompilationError, FileFilter, Project, ProjectCompileOutput,
compilers::{Language, multi::MultiCompilerLanguage},
solc::SolcLanguage,
utils::source_files_iter,
};
use foundry_config::{
Config,
Config, SkipBuildFilters,
figment::{
self, Metadata, Profile, Provider,
error::Kind::InvalidType,
Expand Down Expand Up @@ -103,8 +103,6 @@ impl BuildArgs {
.ignore_eip_3860(self.ignore_eip_3860)
.bail(!format_json);

// Runs the SolidityLinter before compilation.
self.lint(&project, &config)?;
let output = compiler.compile(&project)?;

// Cache project selectors.
Expand All @@ -114,6 +112,11 @@ impl BuildArgs {
sh_println!("{}", serde_json::to_string_pretty(&output.output())?)?;
}

// Only run the `SolidityLinter` if there are no compilation errors
if output.output().errors.iter().all(|e| !e.is_error()) {
self.lint(&project, &config)?;
}

Ok(output)
}

Expand Down Expand Up @@ -147,15 +150,35 @@ impl BuildArgs {
.flat_map(foundry_common::fs::canonicalize_path)
.collect::<Vec<_>>();

let skip = SkipBuildFilters::new(config.skip.clone(), config.root.clone());
let curr_dir = std::env::current_dir()?;
let input_files = config
.project_paths::<SolcLanguage>()
.input_files_iter()
.filter(|p| !(ignored.contains(p) || ignored.contains(&curr_dir.join(p))))
.filter(|p| {
skip.is_match(p)
&& !(ignored.contains(p) || ignored.contains(&curr_dir.join(p)))
})
.collect::<Vec<_>>();

if !input_files.is_empty() {
linter.lint(&input_files);
let sess = linter.init();

let pcx = solar_pcx_from_build_opts(
&sess,
&self.build,
Some(project),
Some(&input_files),
)?;
linter.early_lint(&input_files, pcx);

let pcx = solar_pcx_from_build_opts(
&sess,
&self.build,
Some(project),
Some(&input_files),
)?;
linter.late_lint(&input_files, pcx);
}
}

Expand Down
Loading