ansible / ansible/awx-plugins

linting feedback and helpful commands

Open
#3 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
9
Forks
41
Avg merge
8d 14h
Merged PRs (30d)
2

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`

```yaml
- 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.

```ini
[testenv:pre-commit]
description = Run the quality checks under {basepython}
commands =
{envpython} -Im \
pre_commit run \
--show-diff-on-failure \
{posargs:--all-files}
```

Contributor guide

Open the contributing guide

Research direction

Start by reading .pre-commit-config.yaml to confirm the hook IDs and tox.ini to understand the pre-commit testenv arguments. Determine where this command guidance belongs; done should clearly explain how to run one configured linter against all files and distinguish that from running all linters on selected files.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.