Git Product home page Git Product logo

cargo-graph's People

Contributors

brson avatar bvssvni avatar fragag avatar globin avatar homu avatar kbknapp avatar maxsnew avatar mcarton avatar mikedilger avatar remram44 avatar ryman avatar steveklabnik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cargo-graph's Issues

module graphs?

hi! i wanted to ask if module dependencies within a crate are out of scope or could be implemented.

surely a bigger thing as we’d have to parse rust…

the utility would be detecting dependency cycles and therefore get help with better module structure.

Differentiate dependencies by source

To explore the structure of larger projects, e.g. in workspaces, it is helpful to be able to visually distinguish ‘external’ dependencies (e.g. crates.io crates) and in-house dependencies. There seems to be no feature to do this in v0.3.0.

No root table found for toml file

When running cargo graph on an arbitrary project I receive the following error message:

% cargo graph
error: No root table found for toml file

I have no idea what this error means or how I can get more information about the problem. Any ideas?

Not deterministic

Sorry for bugging you with tricky cases. Fix if you want to.

For crate petgraph, following command:

cargo graph --optional-color orange --optional-line-color orange  --dev-deps true --dev-shape diamond --dev-color red --dev-line-style dashed --dev-line-color red | dot -Tpng > output.png

can produce different colorings of the graph, just rerun to get a chance at getting a different one.

There are more than two variants, but the main variations is the coloring of the regex cluster. Regex' deps are not optional, but seen from petgraph, they are all optional. So coloring them all orange seems to be the right thing?

Cargo.lock for petgraph

output1
output2

Graph only path dependencies (or other filtering)

I tried this on Servo, but there are enough crates that resulting graph is an unreadable mess. It’d be nice to be able to build a graph on only path dependencies (those that don’t have a source entry in Cargo.lock), or have some other kind of filtering to graph fewer crates at a time.

Error when running `cargo graph`

<stdin>:1:2: 1:3 error: unknown start of token: \\
<stdin>:1 C\:> setx path \"%path%;C:\path\to\cargo-graph\binary\"
           ^
thread '<unnamed>' panicked at 'Box<Any>', ../src/libsyntax/parse/lexer/mod.rs:1227
Could not document `cargo-graph`.

Compile error with rustc 1.15.0-nightly (ebeee0e27 2016-12-04)

   Compiling cargo-graph v0.3.0
     Running `rustc /home/zoumi/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-graph-0.3.0/src/main.rs --crate-name cargo_graph --crate-type bin -C opt-level=3 --cfg feature=\"default\" --cfg feature=\"ansi_term\" --cfg feature=\"color\" -C metadata=78981140edc34098 --out-dir /tmp/cargo-install.RRnxogUmQG1e/release/deps --emit=dep-info,link -L dependency=/tmp/cargo-install.RRnxogUmQG1e/release/deps --extern clap=/tmp/cargo-install.RRnxogUmQG1e/release/deps/libclap-5edb29158d4cdcf9.rlib --extern toml=/tmp/cargo-install.RRnxogUmQG1e/release/deps/libtoml-43ec4e65006ca283.rlib --extern ansi_term=/tmp/cargo-install.RRnxogUmQG1e/release/deps/libansi_term-2bdf8e6e86434248.rlib`
error: unnecessary qualification
  --> /home/zoumi/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-graph-0.3.0/src/config.rs:28:1
   |
28 |   arg_enum! {
   |  _^ starting here...
29 | |     #[derive(Debug, Copy, Clone)]
30 | |     pub enum DotLineShape {
31 | |         Solid,
32 | |         Dotted,
33 | |         Dashed
34 | |     }
35 | | }
   | |_^ ...ending here
   |
note: lint level defined here
  --> /home/zoumi/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-graph-0.3.0/src/main.rs:216:9
   |
216|         unused_qualifications)]
   |         ^^^^^^^^^^^^^^^^^^^^^
   = note: this error originates in a macro outside of the current crate

error: unnecessary qualification
  --> /home/zoumi/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-graph-0.3.0/src/config.rs:47:1
   |
47 | arg_enum!{
   | ^
   |
   = note: this error originates in a macro outside of the current crate

error: unnecessary qualification
  --> /home/zoumi/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-graph-0.3.0/src/config.rs:76:1
   |
76 |   arg_enum!{
   |  _^ starting here...
77 | |     #[derive(Debug, Copy, Clone)]
78 | |     pub enum DotShape {
79 | |         Box,
80 | |         Round,
81 | |         Diamond,
82 | |         Triangle
83 | |     }
84 | | }
   | |_^ ...ending here
   |
   = note: this error originates in a macro outside of the current crate

error: aborting due to 3 previous errors

error: failed to compile `cargo-graph v0.3.0`, intermediate artifacts can be found at `/tmp/cargo-install.RRnxogUmQG1e`

Caused by:
  Could not compile `cargo-graph`.

Caused by:
  process didn't exit successfully: `rustc /home/zoumi/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-graph-0.3.0/src/main.rs --crate-name cargo_graph --crate-type bin -C opt-level=3 --cfg feature="default" --cfg feature="ansi_term" --cfg feature="color" -C metadata=78981140edc34098 --out-dir /tmp/cargo-install.RRnxogUmQG1e/release/deps --emit=dep-info,link -L dependency=/tmp/cargo-install.RRnxogUmQG1e/release/deps --extern clap=/tmp/cargo-install.RRnxogUmQG1e/release/deps/libclap-5edb29158d4cdcf9.rlib --extern toml=/tmp/cargo-install.RRnxogUmQG1e/release/deps/libtoml-43ec4e65006ca283.rlib --extern ansi_term=/tmp/cargo-install.RRnxogUmQG1e/release/deps/libansi_term-2bdf8e6e86434248.rlib` (exit code: 101)

*-------------------------------------------------------------------------------------
Default host: x86_64-unknown-linux-gnu
installed toolchains
*--------------------
stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)
installed targets for active toolchain
*--------------------------------------
arm-linux-androideabi
x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl
active toolchain
*----------------
nightly-x86_64-unknown-linux-gnu (default)
rustc 1.15.0-nightly (ebeee0e27 2016-12-04)
*---------------------------------------------------------------------------------------
cenos _7_64bit

Does not work with Cargo 1.41 toml format

Don't know if you're still working on this, but I hope you are! It looks like Cargo 1.41 changed up the format of the Cargo.lock file, so now this only outputs error: No root table found for toml file. If it's an easy fix I might be able to make a PR for it.

Thanks!

"duplicated" regular and dev-dependencies are not separated

I've got a crate with a mess like this:

[dependencies]
memchr = "0.1"
quickcheck = { version = "0.2", optional = true }
itertools = { version = "0.4", optional = true }
odds = { version = "0.2", optional = true }
jetscii = {version = "0.3", features= ["unstable"], optional = true }

[dev-dependencies]
regex = "0.1"
itertools = "0.4"
odds = "0.2"

custom_derive = "0.1"
newtype_derive = "0.1"
rand = "0.3.10"

cargo-graph generates incompatible dot files in powershell

When starting cargo graph in windows' cmd shell, the output file is ASCII text. When you start it in windows' powershell, the output file is Little-endian UTF-16 Unicode text, with CRLF, CR line terminators and a byte order mark.

dot fails to produce pngs from such a file:

PS C:\Users\Benni\repositories\parity> dot -Tpng > rainbow-graph.png cargo-count-ps.dot
Error: cargo-count-ps.dot: syntax error in line 1 near ' ■d'

duplicate key: `version`

Hi!
I wanted to generate a dependency graph for mn mnemonic but cargo-graph gives me the error

File { fd: 3, path: "/home/swym/tmp/mnemonic/Cargo.toml", read: true, write: false }:11:1-11:8 duplicate key: version

I failed to find a duplicate version key manually and also tomlcheck confirms that Cargo.lock seems fine.

gh won't let me attach Cargo.lock but you should be able to reproduce by git cloning mnemonic...

Panic when a crate has dev-dependencies

Cargo graph currently panics often (not always) if the crate has some dev-dependencies.

To reproduce the bug, just create an empty crate with a single dev-dependency and try to run cargo graph a few times on it.

Panic in DepGraph::render_to

Follow up on #15. Graph with deps look nice. Without dev-deps, it panics:

Node N14 doesn't exist, but it tries to add the edge N3 -> N14. N3 is memchr so the only thing it should link to is libc.

$ RUST_BACKTRACE=1 ~/bin/cargo-graph graph 
thread '<main>' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:367
stack backtrace:
   1:     0x5599470a91a0 - sys::backtrace::tracing::imp::write::h2121cc3fd481a5bfxXt
   2:     0x5599470ab565 - panicking::log_panic::_<closure>::closure.41181
   3:     0x5599470aafe0 - panicking::log_panic::h274f0982d2d31f5d62x
   4:     0x55994709ed93 - sys_common::unwind::begin_unwind_inner::ha197e3d3bf39738b4Ps
   5:     0x55994709f128 - sys_common::unwind::begin_unwind_fmt::h377d567d53530218aPs
   6:     0x5599470a8801 - rust_begin_unwind
   7:     0x5599470d7d6f - panicking::panic_fmt::hd08c5b6fdb7b10daxuL
   8:     0x5599470d8048 - panicking::panic::h588d88296fb1b1954sL
   9:     0x559946f4f942 - option::_<impl>::unwrap::unwrap::h16263530560132818147
                        at ../src/libcore/macros.rs:20
  10:     0x559946f4ee67 - graph::_<impl>::label::h10115180723912119468
                        at src/graph.rs:17
  11:     0x559946f490ff - graph::_<impl>::render_to::h7564755762930757336
                        at src/graph.rs:142
  12:     0x559946f43159 - execute::h2d7033028e348fb8ogc
                        at src/main.rs:390
  13:     0x559946f3d2ed - main::h75e0a80141ee56f0Ifc
                        at src/main.rs:378
  14:     0x5599470aad84 - sys_common::unwind::try::try_fn::h1190371136003024825
  15:     0x5599470a8648 - __rust_try
  16:     0x5599470aaa26 - rt::lang_start::h63ca0c2ab43f095fe0x
  17:     0x559946f43399 - main
  18:     0x7f94da5bdb44 - __libc_start_main
  19:     0x559946f30c38 - <unknown>
  20:                0x0 - <unknown>
digraph dependencies {
        N0[label="twoway"];
        N1[label="itertools"];
        N2[label="jetscii"];
        N3[label="memchr"];
        N4[label="odds"];
        N5[label="quickcheck"];
        N6[label="rand"];
        N7[label="advapi32-sys"];
        N8[label="winapi"];
        N9[label="winapi-build"];
        N10[label="libc"];
        N11[label="log"];
        N12[label="unreachable"];
        N13[label="void"];
        N0 -> N1[label=""];
        N0 -> N2[label=""];
        N0 -> N3[label=""];
        N0 -> N4[label=""];
        N0 -> N5[label=""];
        N0 -> N6[label=""];
        N0 -> N7[label=""];
        N0 -> N8[label=""];
        N0 -> N9[label=""];
        N3 -> N14

Compile error with rustc 1.15.0-nightly (ebeee0e27 2016-12-04)

   Compiling cargo-graph v0.3.0
     Running `rustc /home/zoumi/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-graph-0.3.0/src/main.rs --crate-name cargo_graph --crate-type bin -C opt-level=3 --cfg feature=\"default\" --cfg feature=\"ansi_term\" --cfg feature=\"color\" -C metadata=78981140edc34098 --out-dir /tmp/cargo-install.RRnxogUmQG1e/release/deps --emit=dep-info,link -L dependency=/tmp/cargo-install.RRnxogUmQG1e/release/deps --extern clap=/tmp/cargo-install.RRnxogUmQG1e/release/deps/libclap-5edb29158d4cdcf9.rlib --extern toml=/tmp/cargo-install.RRnxogUmQG1e/release/deps/libtoml-43ec4e65006ca283.rlib --extern ansi_term=/tmp/cargo-install.RRnxogUmQG1e/release/deps/libansi_term-2bdf8e6e86434248.rlib`
error: unnecessary qualification
  --> /home/zoumi/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-graph-0.3.0/src/config.rs:28:1
   |
28 |   arg_enum! {
   |  _^ starting here...
29 | |     #[derive(Debug, Copy, Clone)]
30 | |     pub enum DotLineShape {
31 | |         Solid,
32 | |         Dotted,
33 | |         Dashed
34 | |     }
35 | | }
   | |_^ ...ending here
   |
note: lint level defined here
  --> /home/zoumi/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-graph-0.3.0/src/main.rs:216:9
   |
216|         unused_qualifications)]
   |         ^^^^^^^^^^^^^^^^^^^^^
   = note: this error originates in a macro outside of the current crate

error: unnecessary qualification
  --> /home/zoumi/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-graph-0.3.0/src/config.rs:47:1
   |
47 | arg_enum!{
   | ^
   |
   = note: this error originates in a macro outside of the current crate

error: unnecessary qualification
  --> /home/zoumi/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-graph-0.3.0/src/config.rs:76:1
   |
76 |   arg_enum!{
   |  _^ starting here...
77 | |     #[derive(Debug, Copy, Clone)]
78 | |     pub enum DotShape {
79 | |         Box,
80 | |         Round,
81 | |         Diamond,
82 | |         Triangle
83 | |     }
84 | | }
   | |_^ ...ending here
   |
   = note: this error originates in a macro outside of the current crate

error: aborting due to 3 previous errors

error: failed to compile `cargo-graph v0.3.0`, intermediate artifacts can be found at `/tmp/cargo-install.RRnxogUmQG1e`

Caused by:
  Could not compile `cargo-graph`.

Caused by:
  process didn't exit successfully: `rustc /home/zoumi/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-graph-0.3.0/src/main.rs --crate-name cargo_graph --crate-type bin -C opt-level=3 --cfg feature="default" --cfg feature="ansi_term" --cfg feature="color" -C metadata=78981140edc34098 --out-dir /tmp/cargo-install.RRnxogUmQG1e/release/deps --emit=dep-info,link -L dependency=/tmp/cargo-install.RRnxogUmQG1e/release/deps --extern clap=/tmp/cargo-install.RRnxogUmQG1e/release/deps/libclap-5edb29158d4cdcf9.rlib --extern toml=/tmp/cargo-install.RRnxogUmQG1e/release/deps/libtoml-43ec4e65006ca283.rlib --extern ansi_term=/tmp/cargo-install.RRnxogUmQG1e/release/deps/libansi_term-2bdf8e6e86434248.rlib` (exit code: 101)

Default host: x86_64-unknown-linux-gnu

installed toolchains

stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)

installed targets for active toolchain

arm-linux-androideabi
x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl

active toolchain

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.15.0-nightly (ebeee0e27 2016-12-04)

cenos _7_64bit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.