bacon icon indicating copy to clipboard operation
bacon copied to clipboard

Difference between how cargo clippy and bacon clippy treat tests

Open twynb opened this issue 1 year ago • 1 comments

When running cargo clippy, by default, anything behind a #[cfg(test)] or in the tests directory will be ignored. bacon clippy doesn't seem to behave like this - instead, it will run the same lints on the tests too as it always passes the --all-targets option.

Expected behaviour (at least for me) would be that calling bacon clippy without further options behaves the same as cargo clippy does when called without options, and having it run with --all-targets would either be a custom job or a command line option.

twynb avatar Feb 06 '24 15:02 twynb

It's possible to overload the clippy job provided with bacon.

This being said, it seems reasonable to expect the default bacon clippy job to be made of the the default cargo clippy command.

I'll welcome other opinions before modifying the default jobs (or not).

Canop avatar Feb 06 '24 15:02 Canop

I made https://github.com/Canop/bacon/pull/182

Rationale:

  • "clippy" job is confusing since it does more than the vanilla cargo clippy
  • running on all targets should IMO be the default, as it prevents bugs in all targets and not just the default one
  • there are also good reasons (eg performances) to prefer not running on all targets
  • silently moving to only one target would be a breaking change for current users (it matters both to projects with an existing bacon.toml and to those without)

So I

  • added a new "clippy-all" job doing what the old "clippy" job was doing
  • modified the "clippy" job in default bacon.tml to run on only the default target
  • added in the default bacon.toml file an easy to comment out binding from 'c' to "clippy-all" (when removed, 'c' is automatically bound to "clippy")

Canop avatar Apr 07 '24 08:04 Canop