Skip to content

Commit

Permalink
Add empty workspace to Cargo.toml
Browse files Browse the repository at this point in the history
This fixes an issue that arises when the package is installed with pre-commit into a cache directory that is itself a subdirectory of a Cargo workspace, making Cargo think it's a package that should have been a part of the parent workspace.
  • Loading branch information
yuvald-sweet-security committed Dec 22, 2024
1 parent e7a2511 commit 4bfef62
Show file tree
Hide file tree
Showing 38 changed files with 76 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,5 @@ opt-level = 3

[profile.dev.package.similar]
opt-level = 3

[workspace]
2 changes: 2 additions & 0 deletions examples/01_allow_license/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ path = "main.rs"
[dependencies]
shared = { path = "../shared" }
las = { version = "=0.7.7", features = ["laz"] }

[workspace]
2 changes: 2 additions & 0 deletions examples/02_deny_license/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ edition = "2018"
[[bin]]
name = "deny-license"
path = "main.rs"

[workspace]
2 changes: 2 additions & 0 deletions examples/03_deny_copyleft/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ edition = "2018"
[[bin]]
name = "deny-copyleft"
path = "main.rs"

[workspace]
2 changes: 2 additions & 0 deletions examples/04_gnu_licenses/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ edition = "2018"
[[bin]]
name = "gnu-license"
path = "main.rs"

[workspace]
2 changes: 2 additions & 0 deletions examples/06_advisories/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ static_type_map = "0.3"
# The advisory applies to 0.10.0-alpha.1 >= && < 0.10.0-alpha.4
# https://github.com/RustSec/advisory-db/blob/c71cfec8c3fe313c9445a9ab0ae9b7faedda850a/crates/lettre/RUSTSEC-2020-0069.md
lettre = "0.10.0-alpha.3"

[workspace]
2 changes: 2 additions & 0 deletions examples/07_deny_sources/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ gitea-release = { git = "https://tulpa.dev/cadey/gitea-release" }

# This will not be since the base path doesn't match
mlua_serde = { git = "https://tulpa.dev/lua/mlua_serde" }

[workspace]
2 changes: 2 additions & 0 deletions examples/08_target_filtering/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ difference = "2.0.0"

[target.'cfg(all(target_arch = "wasm32", target_feature = "atomics"))'.dependencies]
wasm-bindgen-futures = "0.4.6"

[workspace]
2 changes: 2 additions & 0 deletions examples/09_bans/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ version = "0.10.1"
# duplicate as well!
# default-features = false
# features = ["rustls"]

[workspace]
2 changes: 2 additions & 0 deletions examples/10_allow_build_script/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ edition = "2021"

[dependencies]
openssl-sys = "0.9.74"

[workspace]
2 changes: 2 additions & 0 deletions examples/11_feature_bans/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ reqwest = { version = "=0.11.11", default-features = false, features = [

[features]
foo = []

[workspace]
2 changes: 2 additions & 0 deletions examples/12_yank_check/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ spdx = "=0.3.1"
crate-two = { version = "=0.1.0", registry = "embark-deny" }
# This one is not
crate-one = { version = "=0.1.0", registry = "embark-deny-sparse" }

[workspace]
2 changes: 2 additions & 0 deletions examples/13_license_clarification/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ path = "main.rs"

[dependencies]
rustls-webpki = "=0.100.1"

[workspace]
2 changes: 2 additions & 0 deletions examples/shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ publish = false

[lib]
path = "lib.rs"

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/allow_wrappers/dangerous-dep/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ license = "MIT"

[features]
not-dangerous-at-all = []

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/allow_wrappers/maincrate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ license = "MIT"

[dependencies]
safe-wrapper = { path = "../safe-wrapper", version = "0.1.0" }

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/allow_wrappers/safe-wrapper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ license = "MIT"
dangerous-dep = { version = "0.1.0", path = "../dangerous-dep", features = [
"not-dangerous-at-all",
] }

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/build-bans/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ prost-build = { version = "<0.10", optional = true }
ring = { version = "0.16.20", optional = true }
# The shot heard around the world
serde = { version = "=1.0.172", features = ["derive"], optional = true }

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/cyclic_dependencies/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
[workspace]
members = ["root", "leaf"]

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/cyclic_dependencies/leaf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ edition = "2018"
[dev-dependencies]
root = { path = "../root" }
ansi_term = "0.12.1"

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/cyclic_dependencies/root/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ edition = "2018"
[dependencies]
ansi_term = "0.11.0"
leaf = { path = "../leaf" }

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/duplicates/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ sqlx = "0.5"

[dev-dependencies]
async-graphql = "3.0"

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/features-galore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ stream = ["request?/stream"]
tls = ["tls-no-reqwest", "request?/rustls-tls"]
tls-no-reqwest = ["rustls"]
zlib = ["git/zlib-ng-compat", "request?/deflate"]

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/features/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ serde = ["dep:serde", "rgb?/serde"]
stream = ["request?/stream"]
zlib = ["git/zlib-ng-compat", "request?/deflate"]
ssh = ["git/ssh", "git/ssh_key_from_memory"]

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/non-crates-io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ edition = "2021"
[dependencies]
from-git = { version = "*", package = "crate-one", registry = "embark-deny-git" }
from-sparse = { version = "*", package = "crate-two", registry = "embark-deny-sparse" }

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/non-crates-io/crate-one/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ version = "0.1.0"
edition = "2021"

[dependencies]

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/non-crates-io/crate-two/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ version = "0.2.0"
edition = "2021"

[dependencies]

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/so-annoying/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ name = "so-annoying"
version = "0.1.0"
edition = "2021"
publish = false

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/sources/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ amethyst_core = { git = "https://gitlab.com/amethyst-engine/amethyst", rev = "0c
krates = { git = "https://github.com/EmbarkStudios/krates", branch = "main" }
line-wrap = { git = "https://bitbucket.org/marshallpierce/line-wrap-rs" }
spdx = { git = "https://github.com/EmbarkStudios/spdx", tag = "0.3.4" }

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/wildcards/allow-git/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ publish = false
[dependencies]
# An arbitrary choice of actually existent Git repository
wildcards-test-allow-git = { package = "krates", git = "https://github.com/EmbarkStudios/krates", rev = "b03ecd6f3204a1b1ec04fbaead2d0d122a3a4494" }

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/wildcards/allow-paths-dependency/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ license = "MIT"

[dependencies]
sqlx = "0.5"

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/wildcards/allow-paths-private/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ publish = false

[dependencies]
wildcards-test-allow-paths-dependency = { path = "../allow-paths-dependency" }

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/wildcards/allow-paths-public/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ license = "MIT"

[dependencies]
wildcards-test-allow-paths-dependency = { path = "../allow-paths-dependency" }

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/wildcards/dependency/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ license = "MIT"

[dependencies]
itoa = "*"

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/wildcards/maincrate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ license = "MIT"
[dependencies]
ansi_term = "*"
wildcards-test-dep = { path = "../dependency", version = "0.1.0" }

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/workspace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ unused-version = { version = "0.1", package = "smallvec" }
# Validates we take patches into account when matching workspace dependency sources
spdx-very-old = { git = "https://github.com/EmbarkStudios/spdx", tag = "0.6.0", package = "spdx" }
non-existent = { git = "https://github.com/Lokathor/tinyvec", tag = "v1.6.1", package = "tinyvec" }

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/workspace/crates/member-one/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ spdx-git2 = { git = "https://github.com/EmbarkStudios/spdx", tag = "0.6.1", pack
[build-dependencies]
spdx-very-old = { version = "0.6", git = "https://github.com/EmbarkStudios/spdx", tag = "0.6.0", package = "spdx" }
spdx = { version = "1.13", package = "smallvec" }

[workspace]
2 changes: 2 additions & 0 deletions tests/test_data/workspace/crates/member-two/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ member = { path = "../member-one", package = "member-one" }
[target.'cfg(windows)'.build-dependencies]
crate-two.workspace = true
wildcards-test-allow-git.workspace = true

[workspace]

0 comments on commit 4bfef62

Please sign in to comment.