Skip to content

Commit 7067d0f

Browse files
committed
docs(workflow): Overhaul linting
1 parent a542430 commit 7067d0f

File tree

1 file changed

+108
-10
lines changed

1 file changed

+108
-10
lines changed

docs/contributing/workflow.md

Lines changed: 108 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,24 @@
66

77
[poetry] is a required package to develop.
88

9+
```console
10+
$ git clone https://github.com/vcs-python/libvcs.git
911
```
10-
git clone https://github.com/vcs-python/libvcs.git
11-
cd libvcs
12-
poetry install -E "docs test coverage lint format"
12+
13+
```console
14+
$ cd libvcs
15+
```
16+
17+
```console
18+
$ poetry install -E "docs test coverage lint format"
1319
```
1420

1521
Makefile commands prefixed with `watch_` will watch files and rerun.
1622

1723
## Tests
1824

19-
```
20-
poetry run py.test
25+
```console
26+
$ poetry run py.test
2127
```
2228

2329
Helpers: `make test` Rerun tests on file change: `make watch_test` (requires [entr(1)])
@@ -43,14 +49,105 @@ Rebuild docs on file change: `make watch_docs` (requires [entr(1)])
4349
Rebuild docs and run server via one terminal: `make dev_docs` (requires above, and a `make(1)` with
4450
`-J` support, e.g. GNU Make)
4551

46-
## Formatting / Linting
52+
## Formatting
4753

48-
The project uses [black] and [isort] (one after the other) and runs [flake8] and [mypy] via CI. See
49-
the configuration in `pyproject.toml` and `setup.cfg`:
54+
The project uses [black] and [isort] (one after the other). Configurations are in `pyproject.toml`
55+
and `setup.cfg`:
5056

5157
- `make black isort`: Run `black` first, then `isort` to handle import nuances
52-
- `make flake8`, to watch (requires `entr(1)`): `make watch_flake8`
53-
- `make mypy`, to watch (requires `entr(1)`): `make watch_mypy`
58+
59+
## Linting
60+
61+
[flake8] and [mypy] run via CI in our GitHub Actions. See the configuration in `pyproject.toml` and
62+
`setup.cfg`.
63+
64+
### flake8
65+
66+
[flake8] provides fast, reliable, barebones styling and linting.
67+
68+
````{tab} Command
69+
70+
poetry:
71+
72+
```console
73+
$ poetry run flake8
74+
```
75+
76+
If you setup manually:
77+
78+
```console
79+
$ flake8
80+
```
81+
82+
````
83+
84+
````{tab} make
85+
86+
```console
87+
$ make flake8
88+
```
89+
90+
````
91+
92+
````{tab} Watch
93+
94+
```console
95+
$ make watch_flake8
96+
```
97+
98+
requires [`entr(1)`].
99+
100+
````
101+
102+
````{tab} Configuration
103+
104+
See `[flake8]` in setup.cfg.
105+
106+
```{literalinclude} ../../setup.cfg
107+
:language: ini
108+
:start-at: "[flake8]"
109+
:end-before: "[isort]"
110+
111+
```
112+
113+
````
114+
115+
### mypy
116+
117+
[mypy] is used for static type checking.
118+
119+
````{tab} Command
120+
121+
poetry:
122+
123+
```console
124+
$ poetry run mypy .
125+
```
126+
127+
If you setup manually:
128+
129+
```console
130+
$ mypy .
131+
```
132+
133+
````
134+
135+
````{tab} make
136+
137+
```console
138+
$ make mypy
139+
```
140+
141+
````
142+
143+
````{tab} Watch
144+
145+
```console
146+
$ make watch_mypy
147+
```
148+
149+
requires [`entr(1)`].
150+
````
54151

55152
## Releasing
56153

@@ -68,6 +165,7 @@ Update `__version__` in `__about__.py` and `pyproject.toml`::
68165

69166
[poetry]: https://python-poetry.org/
70167
[entr(1)]: http://eradman.com/entrproject/
168+
[`entr(1)`]: http://eradman.com/entrproject/
71169
[black]: https://github.com/psf/black
72170
[isort]: https://pypi.org/project/isort/
73171
[flake8]: https://flake8.pycqa.org/

0 commit comments

Comments
 (0)