EmbarkStudios / cargo-deny

❌ Cargo plugin for linting your dependencies 🦀

Home Page:http://embark.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

stormshield-gt opened this issue · comments

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

Since #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

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.

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:

  • I have looked at the book before filling the issue but didn't find out about this. I assume that "unused-wrapper" is missing from this section of the book.
  • The cargo deny check -D all bans is not working for me. Indeed All is not a variant of the bans::Code enum. I just read really quickly through the code, maybe there is another way to set the all somewhere

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

Perfect, thanks again for your help!