You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initially, we want to understand which linter is doing what. One way to do this is to comment out all the linters in .pre-commit-config.yaml except the one you want to focus on. That's not the best experience.
We found the below command to work best for the above flow
tox -e pre-commit -- --all-files pyupgrade where pyupgrade is found in .pre-commit-config.yaml in id, under hooks
- hooks:
- id: pyupgrade
Note that if you are googling around you might think the command you want is tox -e pre-commit -- pyupgrade but if you look in tox.ini you will find the below. Note the {posargs:--all-files}{posargs} is referring to the portion after --, the {:--all-files} is the default value to use if no position args are specified. It looks like the intent of this version of commands is to easily allow for running all linters against a single or few command-line specified files. In our initial exploration use case, we want to run one linter against all files.
[testenv:pre-commit]
description = Run the quality checks under {basepython}
commands =
{envpython} -Im \
pre_commit run \
--show-diff-on-failure \
{posargs:--all-files}
The text was updated successfully, but these errors were encountered:
By the way, provided we're going to rewrite history more with that test file, I think it's best to skip running any formatters until that work is done. Otherwise, it'll get erased. Usually, you can't meaningfully rebase/cherry-pick mass-formatting commits.
A trick for skipping certain checks is to declare a SKIP environment variable with comma-separated check ids. I've just plugged bypassing that var into tox. Hope that helps!
Initially, we want to understand which linter is doing what. One way to do this is to comment out all the linters in
.pre-commit-config.yaml
except the one you want to focus on. That's not the best experience.We found the below command to work best for the above flow
tox -e pre-commit -- --all-files pyupgrade
wherepyupgrade
is found in.pre-commit-config.yaml
inid
, underhooks
Note that if you are googling around you might think the command you want is
tox -e pre-commit -- pyupgrade
but if you look intox.ini
you will find the below. Note the{posargs:--all-files}
{posargs}
is referring to the portion after--
, the{:--all-files}
is the default value to use if no position args are specified. It looks like the intent of this version ofcommands
is to easily allow for running all linters against a single or few command-line specified files. In our initial exploration use case, we want to run one linter against all files.The text was updated successfully, but these errors were encountered: