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
This is often considerably faster for large projects, because `pre-commit`
87
+
can avoid running `flake8_trio` on unchanged files.
88
+
89
+
90
+
Afterwards, run
91
+
```sh
92
+
pip install pre-commit flake8-trio
93
+
pre-commit run .
94
+
```
95
+
### install and run as standalone
96
+
If inside a git repository, running without arguments will run it against all `*.py` files in the repository.
97
+
```sh
98
+
pip install flake8-trio
99
+
flake8_trio
100
+
```
101
+
#### with autofixes
102
+
```sh
103
+
flake8_trio --autofix=TRIO
104
+
```
105
+
#### specifying source files
106
+
```sh
107
+
flake8_trio my_python_file.py
108
+
```
109
+
##### zsh-only
110
+
```zsh
111
+
flake8_trio **/*.py
112
+
```
113
+
66
114
## Configuration
67
115
[You can configure `flake8` with command-line options](https://flake8.pycqa.org/en/latest/user/configuration.html),
68
116
but we prefer using a config file. The file needs to start with a section marker `[flake8]` and the following options are then parsed using flake8's config parser, and can be used just like any other flake8 options.
@@ -75,7 +123,7 @@ Comma-separated list of error codes to enable, similar to flake8 --select but is
75
123
Comma-separated list of error codes to disable, similar to flake8 --ignore but is additionally more performant as it will disable non-enabled visitors from running instead of just silencing their errors.
76
124
77
125
### `--autofix`
78
-
Comma-separated list of error-codes to enable autofixing for if implemented. Requires running as a standalone program.
126
+
Comma-separated list of error-codes to enable autofixing for if implemented. Requires running as a standalone program. Pass `--autofix=TRIO` to enable all autofixes.
79
127
80
128
### `--error-on-autofix`
81
129
Whether to also print an error message for autofixed errors.
@@ -84,7 +132,7 @@ Whether to also print an error message for autofixed errors.
84
132
Change the default library to be anyio instead of trio. If trio is imported it will assume both are available and print suggestions with [anyio|trio].
85
133
86
134
### `no-checkpoint-warning-decorators`
87
-
Specify a list of decorators to disable checkpointing checks for, turning off TRIO910 and TRIO911 warnings for functions decorated with any decorator matching any in the list. Matching is done with [fnmatch](https://docs.python.org/3/library/fnmatch.html). Defaults to disabling for `asynccontextmanager`.
135
+
Comma-separated list of decorators to disable checkpointing checks for, turning off TRIO910 and TRIO911 warnings for functions decorated with any decorator matching any in the list. Matching is done with [fnmatch](https://docs.python.org/3/library/fnmatch.html). Defaults to disabling for `asynccontextmanager`.
88
136
89
137
Decorators-to-match must be identifiers or dotted names only (not PEP-614 expressions), and will match against the name only - e.g. `foo.bar` matches `foo.bar`, `foo.bar()`, and `foo.bar(args, here)`, etc.
90
138
@@ -136,21 +184,3 @@ async def my_function():
136
184
137
185
arbitrary_other_function(my_blocking_call=None)
138
186
```
139
-
140
-
141
-
### Using flake8_trio with pre-commit
142
-
If you use [pre-commit](https://pre-commit.com/), you can use it with flake8_trio by
143
-
adding the following to your `.pre-commit-config.yaml`:
0 commit comments