houseabsolute / precious

One code quality tool to rule them all
Apache License 2.0
82 stars 4 forks source link

Running both `lint` and `tidy` #38

Open aktasfatih opened 2 years ago

aktasfatih commented 2 years ago

Hi, is there a subcommand to run both lint and tidy in one command ?

autarch commented 2 years ago

No, there's not. Are you imagining it would run tidy first, then lint? I think that's not too hard to add.

aktasfatih commented 2 years ago

Yes, that is what I had in my mind. Anything that runs both when one of lint or tidy is not specified, or an extra command like clean that could do the job. I could create a PR if you like, depending on your preference.

autarch commented 2 years ago

I don't think I'd want this to be the default behavior, but a new subcommand called clean would work. I'm not sure about the name, but that's easy enough to change before this is released.

If you're up for a it, a PR would be great!

I'm in the middle of some big changes to this code, but I think you should only need to change the precious-core/src/precious.rs file for a PR to add this, as well as the README.md and adding some integration tests in precious-integration. I'm pretty sure that won't have any significant conflicts with what I'm working on. If there are conflicts I can figure them out.

But just take this as a heads up that it might take me a little longer to review and merge this PR than it otherwise might.

aktasfatih commented 2 years ago

No worries. It is not urgent. Thanks for the quick reply and the heads up. 👍 I'll get on it.

oschwald commented 2 years ago

I agree that this would be a nice feature to have.

For most programs that have a tidy/fix option (e.g., golangci-lint, black, etc.), I think it would be sufficient to only run tidy when the command can do both. I assume there are cases where this is not true, but it would be nice to avoid the extra lint run where it is true.

autarch commented 2 years ago

That's a good point, @oschwald. Some sort of config key for this would be good, like no_lint_on_both or something like that.