mainmatter / cargo-autoinherit

(Auto)DRY for your Rust dependencies
Apache License 2.0
130 stars 8 forks source link

Add a subcommand to verify all dependencies are inherited #2

Open MarcoIeni opened 7 months ago

MarcoIeni commented 7 months ago

It would be great to run this tool in CI to check if there are no duplicate dependencies across the workspace (i.e. all compatible dependencies are inherited).

Something like cargo autoinherit check.

This command should:

additional feature

There could be an additional flag to forbid dependencies which aren't inherited. Useful for maintainers who wants to specify all dependencies verdions in the main Cargo.toml

LukeMathWalker commented 7 months ago

That'd be quite nice!

I would use the same CLI structure of cargo fmt (i.e. cargo autoinherit --check) though.

MarcoIeni commented 7 months ago

Yes, I think it's fine đź‘Ť The only downside I see is that there could be confusion if we want to add other flags to the check operation. We should explain that certain flags only apply if the check flag is passed.

This risk can be mitigated with a configuration file. I.e. devs specify their desired behavior with the config file instead of flags.

LukeMathWalker commented 7 months ago

I lean towards having minimal or no configuration options, although it's always difficult to predict the future. A proper sub-command is certainly more flexible.

ModProg commented 7 months ago

There could also be a flag to warn on mismatched versions as described in the readme, so they can be resolved manually

LukeMathWalker commented 7 months ago

There could also be a flag to warn on mismatched versions as described in the readme, so they can be resolved manually

That's already the case—any version conflict is reported in the terminal. We exit with a success status code though.