EmbarkStudios / cargo-deny

❌ Cargo plugin for linting your dependencies 🦀
http://embark.rs
Apache License 2.0
1.62k stars 80 forks source link

Add a way to turn `warning[unused-wrapper]` into hard error #665

Closed stormshield-gt closed 3 weeks ago

stormshield-gt commented 3 weeks ago

Is your feature request related to a problem? Please describe.

Since https://github.com/EmbarkStudios/cargo-deny/issues/405 we have a way to detect unused deny wrappers which is great. However, this detection only emits warning and don't fail the process when doing cargo deny check ban, so it's easy to ignore it in CI.

Describe the solution you'd like

It would be great if it we could have the possibility to turn those into hard error. Like the "warning as error" of clippy

Describe alternatives you've considered

I could hack a bash script that detects if something was output to stderr and failed in that the case.

cargo deny check bans 2> /tmp/stderr.log
[ -s /tmp/foo.stderr ] &&  exit 1

But I don't think it's a reliable solution

Jake-Shadle commented 3 weeks ago

You can use -D just as with cargo clippy to deny specific lints, so using cargo deny check -D unused-wrapper bans or cargo deny check -D all bans could be used in CI.

stormshield-gt commented 3 weeks ago

Thank you a lot for your quick answer, cargo deny check -D unused-wrapper bans works for me.

I noticed 2 small things, that I think it might be worth sharing:

Jake-Shadle commented 3 weeks ago

Sorry I misremembered, it's -D warnings|allowed.

stormshield-gt commented 3 weeks ago

Perfect, thanks again for your help!