-
Notifications
You must be signed in to change notification settings - Fork 34
linting feedback and helpful commands #3
Description
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: pyupgradeNote 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}