bnjbvr / cargo-machete

Remove unused Rust dependencies with this one weird trick!
MIT License
784 stars 28 forks source link

Fail if `Cargo.toml` annotations don't match what we expect #60

Closed bnjbvr closed 7 months ago

bnjbvr commented 1 year ago

It's easy to write ignore = true instead of ignored = true in the machete metadata section in a Cargo.toml file. Right now it'll fail the analysis of that specific package, but not overall; it might be better to make this a hard error instead, that fails the whole analysis (after displaying the analysis results for other crates).

tottoto commented 1 year ago

Can I take this issue?

bnjbvr commented 1 year ago

Sure, please go ahead and let me know if you need any help!

tottoto commented 1 year ago

Thanks! I will work on this.

rolemadelen commented 7 months ago

Hi @bnjbvr, @tottoto is this issue still ongoing?

bnjbvr commented 7 months ago

hi @rolemadelen, thanks for the ping. Actually it's not anymore, because we consider the ignored vec as mandatory, if the package.metadata.cargo-machete annotation is present, so it will error with the following message if we use ignore instead of ignored:

error when handling ./integration-tests/ignored-dep/Cargo.toml: TOML parse error at line 14, column 1
   |
14 | [package.metadata.cargo-machete]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
missing field `ignored