Skip to content

Latest commit

 

History

History
82 lines (56 loc) · 2.55 KB

README.md

File metadata and controls

82 lines (56 loc) · 2.55 KB
Cargo-Ensure-No-Cyclic-Deps Logo

Cargo-Ensure-No-Cyclic-Deps

crates.io docs.rs MSRV CI Coverage License This crate was developed as part of the Oxidizer project

A cargo sub-command that detects cyclic dependencies between crates in a workspace. This is useful if you want to prevent dev-dependencies from creating dependency cycles as that can cause issues, e.g. for cargo-release.

Usage

Run this command in a cargo workspace:

cargo ensure-no-cyclic-deps

The command will:

  • Analyze all workspace crates
  • Check for cyclic dependencies (including dev-dependencies)
  • Report any cycles found
  • Exit with code 1 if cycles are detected, 0 otherwise

Installation

cargo install --path .

Or from within the workspace:

cargo install cargo-ensure-no-cyclic-deps

Example Output

When cycles are detected:

Error: Cyclic dependencies detected!

Cycle 1:
  crate_a -> crate_b -> crate_c -> crate_a

Cycle 2:
  crate_x -> crate_y -> crate_x

When no cycles are found:

No cyclic dependencies found.

The tool will exit with code 0 if no cycles are found, or code 1 if cycles are detected.

Cycle Reporting

When multiple cycles exist within the same strongly connected component, the tool reports one representative directed cycle for that component, with self-loops reported separately. Resolving the reported cycle may reveal remaining cycles in the same component on subsequent runs.


This crate was developed as part of The Oxidizer Project. Browse this crate's source code.