Skip to content

Commit f891afd

Browse files
authored
feat(forge): no warning on external config sections (#11869)
feat(forge): no warning on external sections
1 parent c40bd19 commit f891afd

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

crates/config/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,9 @@ impl Config {
679679
/// TOML section for profiles
680680
pub const PROFILE_SECTION: &'static str = "profile";
681681

682+
/// External config sections, ignored from warnings.
683+
pub const EXTERNAL_SECTION: &'static str = "external";
684+
682685
/// Standalone sections in the config which get integrated into the selected profile
683686
pub const STANDALONE_SECTIONS: &'static [&'static str] = &[
684687
"rpc_endpoints",

crates/config/src/providers/warnings.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ impl<P: Provider> WarningsProvider<P> {
4848
data.keys()
4949
.filter(|k| {
5050
**k != Config::PROFILE_SECTION
51+
&& **k != Config::EXTERNAL_SECTION
5152
&& !Config::STANDALONE_SECTIONS.iter().any(|s| s == k)
5253
})
5354
.map(|unknown_section| {

crates/forge/tests/cli/config.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,3 +1924,24 @@ Warning: Key `deny_warnings` is being deprecated in favor of `deny = warnings`.
19241924
19251925
"#]]);
19261926
});
1927+
1928+
// <https://github.com/foundry-rs/foundry/issues/5866>
1929+
forgetest!(no_warnings_on_external_sections, |prj, cmd| {
1930+
cmd.git_init();
1931+
1932+
let toml = r"[profile.default]
1933+
src = 'src'
1934+
out = 'out'
1935+
1936+
# Custom sections for other tools
1937+
[external.scopelint]
1938+
some_flag = 1
1939+
1940+
[external.forge_deploy]
1941+
another_setting = 123";
1942+
1943+
fs::write(prj.root().join("foundry.toml"), toml).unwrap();
1944+
cmd.forge_fuse().args(["config"]).assert_success().stderr_eq(str![[r#"
1945+
1946+
"#]]);
1947+
});

0 commit comments

Comments
 (0)