houseabsolute / precious

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

Create stub config files #53

Closed oalders closed 10 months ago

oalders commented 12 months ago

As a wishlist item, it would be cool to have precious config --create to create a stub config file, maybe including some defaults for various languages.

precious config --create --lang go --lang bash precious.toml

I added something like this to perlimports and I use it all the time:

perlimports --create-config-file perlimports.toml

This is somewhat related to #3

autarch commented 11 months ago

I have a first pass at this in the config-init branch that handles the following components:

If you have any suggestions for config for other languages I can include those too, but I haven't really used precious with anything else yet.

oalders commented 11 months ago

The branch looks great! I tried it out and I love that it creates dev/bin/check-go-mod.sh for you. I would be able to use that right away.

For Perl, I would suggest adding:

[commands.perlimports]
type = "both"
include = [ "**/*.{pl,pm,t,psgi}" ]
cmd = [ "perlimports" ]
lint_flags = ["--lint" ]
tidy_flags = ["-i" ]
ok_exit_codes = 0
expect_stderr = true

It might also be helpful if you could specify a different config file path rather than the default, so that you could create one in your home directory or with a .precious.toml. I'm testing this out in the top level of the repo and I had to blow away the original config file to test this. Not a big deal, though. I'd file that under "nice to have".

autarch commented 10 months ago

This is done in v0.6.0.

oalders commented 10 months ago

Thank you!