-
Notifications
You must be signed in to change notification settings - Fork 109
Description
Motivation
In our private repository we have more than 100 duplicate dependencies, and deduplicating them is painful. It is also painful to maintain the deny.toml file with all the bans.skip and bans.skip_tree entries manually.
In fact, even though the bans.skip_tree is intended as a "wildcard skip", but this one hides too many things, and naive developers sometimes put the skip config under skip_tree by mistake therefore making things even worse.
Proposed Solution
cargo deny could generate something like a deny.lock, that locks the list of licences, sources and duplicate crate versions that it found in the repo. That file must be entirely generated by cargo-deny itself thus relieving people from manually maintaining it. Could be generated with something like cargo deny lock update and people could make sure it is up-to-date on CI with cargo deny lock check.
This way, if people add a new dependency that uses some new license or introduces duplicate deps, CI will always fail on cargo deny lock check showing the diff of what changed in the repo's deny.lock - forcing them either to re-review their change to dependencies if an undesired license is added or a new duplicate/source appeared, or accept the diff to the lockfile with cargo deny lock update which will be explicitly visible in the PR's diff.
Comments
We may allow developers to leave comments in the lock file. A crate like toml_edit can parse a TOML file and edit it losslessly while preserving comments.
I think that's a brilliant idea. I may try to work on it when I have some spare time (right now I'm a bit busy with some other projects). I know that's a pretty big shift from how licenses/sources/bans are managed now (manually in deny.toml), but I think it's worth it and the lock file feature can be opt-in (at least initially).
@Jake-Shadle I hope to get your approval on this idea. I'm not going to work on it immediately, but just planning for some future (unless someone else would like to work on it before then)