From 9210c9e0c6a65e5751e462a21d60de1d34808f3a Mon Sep 17 00:00:00 2001 From: Evgeniy Dikevich Date: Wed, 3 Sep 2025 17:55:21 +0200 Subject: [PATCH 1/4] fix(general): Fix proxy-cache project URL for spectral (#446) Signed-off-by: Evgeniy Dikevich --- earthly/spectral/Earthfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/earthly/spectral/Earthfile b/earthly/spectral/Earthfile index 5eb75e229..0c9dd4058 100644 --- a/earthly/spectral/Earthfile +++ b/earthly/spectral/Earthfile @@ -3,7 +3,7 @@ VERSION 0.8 # cspell: words ruleset spectral-base: - FROM harbor.shared-services.projectcatalyst.io/dockerhub/library/stoplight/spectral:6.13.1 + FROM harbor.shared-services.projectcatalyst.io/dockerhub/stoplight/spectral:6.13.1 WORKDIR /work LINT: From 01ef7102a689699cbf2feb083dc635829fae1485 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Tue, 5 Aug 2025 12:51:16 +0700 Subject: [PATCH 2/4] feat(rust): Disallows Debug format derivation and Debug formatting in release code. --- earthly/rust/stdcfgs/cargo_manifest/project.toml | 2 ++ earthly/rust/stdcfgs/cargo_manifest/workspace.toml | 2 ++ earthly/rust/stdcfgs/clippy.toml | 3 +++ examples/rust/Cargo.toml | 2 ++ examples/rust/clippy.toml | 3 +++ examples/rust/crates/foo/src/main.rs | 6 +++++- 6 files changed, 17 insertions(+), 1 deletion(-) diff --git a/earthly/rust/stdcfgs/cargo_manifest/project.toml b/earthly/rust/stdcfgs/cargo_manifest/project.toml index f4899878a..88a0c6779 100644 --- a/earthly/rust/stdcfgs/cargo_manifest/project.toml +++ b/earthly/rust/stdcfgs/cargo_manifest/project.toml @@ -36,3 +36,5 @@ unchecked_duration_subtraction = "deny" unreachable = "deny" missing_docs_in_private_items = "deny" arithmetic_side_effects = "deny" +use_debug = "deny" +disallowed-macros = "deny" diff --git a/earthly/rust/stdcfgs/cargo_manifest/workspace.toml b/earthly/rust/stdcfgs/cargo_manifest/workspace.toml index f03b03828..e6ac972ac 100644 --- a/earthly/rust/stdcfgs/cargo_manifest/workspace.toml +++ b/earthly/rust/stdcfgs/cargo_manifest/workspace.toml @@ -36,3 +36,5 @@ unchecked_duration_subtraction = "deny" unreachable = "deny" missing_docs_in_private_items = "deny" arithmetic_side_effects = "deny" +use_debug = "deny" +disallowed-macros = "deny" diff --git a/earthly/rust/stdcfgs/clippy.toml b/earthly/rust/stdcfgs/clippy.toml index caa289b27..2a139cd09 100644 --- a/earthly/rust/stdcfgs/clippy.toml +++ b/earthly/rust/stdcfgs/clippy.toml @@ -2,3 +2,6 @@ allow-unwrap-in-tests = true allow-expect-in-tests = true allow-panic-in-tests = true arithmetic-side-effects-allowed = ["num_bigint::BigInt"] +disallowed-macros = [ + { path = "std::fmt::Debug", reason = "Debug Formatting not permitted in production release code.\nUse #[cfg_attr(debug_assertions, derive(Debug)] instead." }, +] diff --git a/examples/rust/Cargo.toml b/examples/rust/Cargo.toml index 0b8607d25..0fa57a187 100644 --- a/examples/rust/Cargo.toml +++ b/examples/rust/Cargo.toml @@ -45,3 +45,5 @@ unchecked_duration_subtraction = "deny" unreachable = "deny" missing_docs_in_private_items = "deny" arithmetic_side_effects = "deny" +use_debug = "deny" +disallowed-macros = "deny" diff --git a/examples/rust/clippy.toml b/examples/rust/clippy.toml index caa289b27..2a139cd09 100644 --- a/examples/rust/clippy.toml +++ b/examples/rust/clippy.toml @@ -2,3 +2,6 @@ allow-unwrap-in-tests = true allow-expect-in-tests = true allow-panic-in-tests = true arithmetic-side-effects-allowed = ["num_bigint::BigInt"] +disallowed-macros = [ + { path = "std::fmt::Debug", reason = "Debug Formatting not permitted in production release code.\nUse #[cfg_attr(debug_assertions, derive(Debug)] instead." }, +] diff --git a/examples/rust/crates/foo/src/main.rs b/examples/rust/crates/foo/src/main.rs index e2bd9f32b..77101ac19 100644 --- a/examples/rust/crates/foo/src/main.rs +++ b/examples/rust/crates/foo/src/main.rs @@ -5,7 +5,8 @@ use clap::Parser; use foo::fmt_hello; /// Simple program to greet a person -#[derive(Parser, Debug)] +#[cfg_attr(debug_assertions, derive(Debug))] +#[derive(Parser)] #[command(author, version, about, long_about = None)] struct Args { /// Name of the person to greet @@ -21,6 +22,9 @@ struct Args { fn main() { let args = Args::parse(); + #[cfg(debug_assertions)] + println!("{args:?}"); + for cnt in 0..args.count { println!("{}", fmt_hello(&args.name, cnt)); } From b399ff426c9635c9e651e25563f48489ab21a863 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Wed, 6 Aug 2025 16:25:06 +0700 Subject: [PATCH 3/4] fix(rust): Fix error message suggestion for disallowed Debug derivation macro --- earthly/rust/stdcfgs/clippy.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/earthly/rust/stdcfgs/clippy.toml b/earthly/rust/stdcfgs/clippy.toml index 2a139cd09..3e9f94142 100644 --- a/earthly/rust/stdcfgs/clippy.toml +++ b/earthly/rust/stdcfgs/clippy.toml @@ -3,5 +3,5 @@ allow-expect-in-tests = true allow-panic-in-tests = true arithmetic-side-effects-allowed = ["num_bigint::BigInt"] disallowed-macros = [ - { path = "std::fmt::Debug", reason = "Debug Formatting not permitted in production release code.\nUse #[cfg_attr(debug_assertions, derive(Debug)] instead." }, + { path = "std::fmt::Debug", reason = "Debug Formatting not permitted in production release code.\nUse `#[cfg_attr(debug_assertions, derive(Debug))]` instead." }, ] From 7d9935abe5030c9c351a89dde88e017692425069 Mon Sep 17 00:00:00 2001 From: Uladzislau Borbut Date: Wed, 3 Sep 2025 18:58:40 +0200 Subject: [PATCH 4/4] fix: clippy.toml in example --- examples/rust/clippy.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/rust/clippy.toml b/examples/rust/clippy.toml index 2a139cd09..3e9f94142 100644 --- a/examples/rust/clippy.toml +++ b/examples/rust/clippy.toml @@ -3,5 +3,5 @@ allow-expect-in-tests = true allow-panic-in-tests = true arithmetic-side-effects-allowed = ["num_bigint::BigInt"] disallowed-macros = [ - { path = "std::fmt::Debug", reason = "Debug Formatting not permitted in production release code.\nUse #[cfg_attr(debug_assertions, derive(Debug)] instead." }, + { path = "std::fmt::Debug", reason = "Debug Formatting not permitted in production release code.\nUse `#[cfg_attr(debug_assertions, derive(Debug))]` instead." }, ]