pre-commit-ci / issues

public issues for https://pre-commit.ci
17 stars 3 forks source link

Add a configuration option ``args`` #134

Closed nstarman closed 1 year ago

nstarman commented 2 years ago

We at https://github.com/astropy/astropy like pre-commit and have it set up to check PRs. We are looking into transition from using tox to pre-commit.ci for the code-style checks (see https://github.com/astropy/asdf-astropy/pull/97 for our testing). Our use case is that users should be able to run pre-commit on their machines and fix code, but we are not yet ready for PRs to be auto-fixed server side. tox can pass args when it runs pre-commit — e.g. https://github.com/astropy/astropy/blob/2db90d0bf95daa3d065c1d97207ebe4b2bdad00d/tox.ini#L143-L150 — allowing us to not fix PRs and to display the full log trace. Pre-commit.ci offers [autofix_prs](https://pre-commit.ci/#configuration-autofix_prs) but not a way to increase error message verbosity, so the error trace is not shown. This is preventing our transition. It would be great if either more pre-commit command line arguments were explicitly supported, or just args to allow the user to pass any arg.

Thanks for developing this tool!

asottile commented 2 years ago

what args are you looking for specifically? note that output is quickly truncated so if you're looking for --show-diff-on-failure it won't be that useful

asottile commented 2 years ago

I could probably just make the warning message at the bottom display if autofixing is disabled with instructions -- is there a reason you're opting to turn it off?

nstarman commented 2 years ago

what args are you looking for specifically?

The current set of args we have in tox is --color always --all-files --show-diff-on-failure. Hopefully with pre-commit.ci we can remove the --all-files.

note that output is quickly truncated so if you're looking for --show-diff-on-failure it won't be that useful

Thanks for the warning; --show-diff-on-failure is the one we are most interested in.

I could probably just make the warning message at the bottom display if autofixing is disabled with instructions

That would be excellent, thanks!

is there a reason you're opting to turn it off?

Many of our contributors are less experienced coders. Auto-adding commits requires pulling from source before new commits can be added. We are trying to adiabatically increase the sophistication of our infrastructure, assessing what our contributor base is comfortable with.

asottile commented 1 year ago

going to track this in #65