From 27254f2e0bd60fb7dab3483e35370d5398108141 Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Tue, 9 Jun 2026 16:21:54 +0200 Subject: [PATCH 1/2] fix workspace location behaviour --- cargo_pup_lint_config/src/lint_builder_ext.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cargo_pup_lint_config/src/lint_builder_ext.rs b/cargo_pup_lint_config/src/lint_builder_ext.rs index c001ffe..0e97105 100644 --- a/cargo_pup_lint_config/src/lint_builder_ext.rs +++ b/cargo_pup_lint_config/src/lint_builder_ext.rs @@ -218,11 +218,23 @@ fn find_workspace_root() -> Result { if dir.join("src").join("pup_driver.rs").exists() { return Ok(dir.to_path_buf()); } + + let cargo_toml = dir.join("Cargo.toml"); + if cargo_toml.exists() + && let Ok(contents) = std::fs::read_to_string(&cargo_toml) + && contents.contains("name = \"cargo_pup\"") + { + return Ok(dir.to_path_buf()); + } + check_dir = dir.parent(); } - // If we can't find workspace root, return current directory - Ok(current_dir) + // Neither walking up from the test binary nor from the current working + // directory found a real cargo-pup workspace. Bail so the caller falls + // back to the system-installed `cargo pup` instead of accidentally + // treating the user's own project directory as the cargo-pup workspace. + anyhow::bail!("Failed to find cargo-pup workspace root") } fn run_command(lint_builder: &LintBuilder, command: &str, args: &[&str]) -> Result { From 144ea9faa70bad2a7c36355d00c34f4a885f43de Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Tue, 9 Jun 2026 16:24:44 +0200 Subject: [PATCH 2/2] bump to 0.1.8 --- Cargo.lock | 8 ++++---- Cargo.toml | 8 ++++---- README.md | 2 +- cargo_pup_common/Cargo.toml | 2 +- cargo_pup_lint_config/Cargo.toml | 4 ++-- cargo_pup_lint_config/README.md | 2 +- cargo_pup_lint_impl/Cargo.toml | 6 +++--- test_app/Cargo.lock | 4 ++-- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b8e094e..42ef800 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -156,7 +156,7 @@ dependencies = [ [[package]] name = "cargo_pup" -version = "0.1.7" +version = "0.1.8" dependencies = [ "ansi_term", "anyhow", @@ -175,7 +175,7 @@ dependencies = [ [[package]] name = "cargo_pup_common" -version = "0.1.7" +version = "0.1.8" dependencies = [ "anyhow", "cargo_metadata 0.23.1", @@ -186,7 +186,7 @@ dependencies = [ [[package]] name = "cargo_pup_lint_config" -version = "0.1.7" +version = "0.1.8" dependencies = [ "anyhow", "cargo_pup_common", @@ -197,7 +197,7 @@ dependencies = [ [[package]] name = "cargo_pup_lint_impl" -version = "0.1.7" +version = "0.1.8" dependencies = [ "anyhow", "cargo_pup_common", diff --git a/Cargo.toml b/Cargo.toml index 5319e1b..0d908a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ exclude = ["test_app"] [package] name = "cargo_pup" -version = "0.1.7" +version = "0.1.8" edition = "2024" description = "A Rust architectural linting tool that integrates with rustc to enforce architectural patterns and boundaries" license = "Apache-2.0" @@ -34,9 +34,9 @@ anyhow = { workspace = true } tempfile = { workspace = true } ron = { workspace = true } cargo_metadata = { workspace = true } -cargo_pup_common = { path = "cargo_pup_common", version = "=0.1.7" } -cargo_pup_lint_impl = { path = "cargo_pup_lint_impl", version = "=0.1.7" } -cargo_pup_lint_config = { path = "cargo_pup_lint_config", version = "=0.1.7" } +cargo_pup_common = { path = "cargo_pup_common", version = "=0.1.8" } +cargo_pup_lint_impl = { path = "cargo_pup_lint_impl", version = "=0.1.8" } +cargo_pup_lint_config = { path = "cargo_pup_lint_config", version = "=0.1.8" } # # These bits are just to keep rust rover happy. diff --git a/README.md b/README.md index 65a9bd2..0833ab2 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ First, add the following to your `Cargo.toml`: ```toml [dev-dependencies] -cargo_pup_lint_config = "0.1.7" +cargo_pup_lint_config = "0.1.8" ``` ## Examples diff --git a/cargo_pup_common/Cargo.toml b/cargo_pup_common/Cargo.toml index d075076..955747f 100644 --- a/cargo_pup_common/Cargo.toml +++ b/cargo_pup_common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo_pup_common" -version = "0.1.7" +version = "0.1.8" edition = "2024" description = "Common utilities and shared components for cargo-pup architectural linting tool" license = "Apache-2.0" diff --git a/cargo_pup_lint_config/Cargo.toml b/cargo_pup_lint_config/Cargo.toml index 6b713dd..bcb84db 100644 --- a/cargo_pup_lint_config/Cargo.toml +++ b/cargo_pup_lint_config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo_pup_lint_config" -version = "0.1.7" +version = "0.1.8" edition = "2024" description = "Configuration and rule builder utilities for cargo-pup architectural linting" license = "Apache-2.0" @@ -13,4 +13,4 @@ serde.workspace = true ron.workspace = true tempfile.workspace = true anyhow.workspace = true -cargo_pup_common = { path = "../cargo_pup_common", version = "=0.1.7" } +cargo_pup_common = { path = "../cargo_pup_common", version = "=0.1.8" } diff --git a/cargo_pup_lint_config/README.md b/cargo_pup_lint_config/README.md index ec9945c..024e8bc 100644 --- a/cargo_pup_lint_config/README.md +++ b/cargo_pup_lint_config/README.md @@ -24,7 +24,7 @@ Add this to your `Cargo.toml`: ```toml [dev-dependencies] -cargo_pup_lint_config = "0.1.7" +cargo_pup_lint_config = "0.1.8" ``` ## Example diff --git a/cargo_pup_lint_impl/Cargo.toml b/cargo_pup_lint_impl/Cargo.toml index be41a86..b41e1ef 100644 --- a/cargo_pup_lint_impl/Cargo.toml +++ b/cargo_pup_lint_impl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo_pup_lint_impl" -version = "0.1.7" +version = "0.1.8" edition = "2024" description = "Core lint implementations and rustc integration for cargo-pup architectural linting" license = "Apache-2.0" @@ -9,8 +9,8 @@ homepage = "https://github.com/datadog/cargo-pup" readme = "README.md" [dependencies] -cargo_pup_lint_config = { path = "../cargo_pup_lint_config", version = "=0.1.7" } -cargo_pup_common = { path = "../cargo_pup_common", version = "=0.1.7" } +cargo_pup_lint_config = { path = "../cargo_pup_lint_config", version = "=0.1.8" } +cargo_pup_common = { path = "../cargo_pup_common", version = "=0.1.8" } anyhow.workspace = true regex.workspace = true serde_json.workspace = true diff --git a/test_app/Cargo.lock b/test_app/Cargo.lock index c34abd1..8b0f8f1 100644 --- a/test_app/Cargo.lock +++ b/test_app/Cargo.lock @@ -52,7 +52,7 @@ dependencies = [ [[package]] name = "cargo_pup_common" -version = "0.1.6" +version = "0.1.8" dependencies = [ "anyhow", "cargo_metadata", @@ -63,7 +63,7 @@ dependencies = [ [[package]] name = "cargo_pup_lint_config" -version = "0.1.6" +version = "0.1.8" dependencies = [ "anyhow", "cargo_pup_common",