cargo-check icon indicating copy to clipboard operation
cargo-check copied to clipboard

Recursively lint path-local crates

Open HybridEidolon opened this issue 8 years ago • 0 comments

I would like to see an option, such as --recur-local, that checks the dependency list for the current crate and recurs, building a list of dependencies that are path-local, for example:

[dependencies]
subcrate = { path = "subcrate" }
subcrate2 = { path = "subcrate2" }

where each subcrate may have further local dependencies.

After building this list, the command would invoke cargo check -p <dep> on each one and append all the warning output until it reached the top crate.

The use case is in large projects that split their code into trees of crates to reduce iteration time or better organize independent parts. Currently, if you invoke cargo check, the dependencies will only be linted when they need to be recompiled. This hinders the output that parsers like Syntastic or atom-linter have to work with.

Problems with this would be when there's an error in a leaf crate. Because rustc needs rlibs to reference symbols from, if a lower level crate fails to compile, the upper ones can't even be checked with -Zno-trans. Another issue is that invoking cargo rustc or cargo build at all, even with -Zno-trans, causes cargo to delete the existing artifacts for the crate, so lower level crates would have to be recompiled anyway for the full lint.

HybridEidolon avatar Jan 15 '16 10:01 HybridEidolon