Anthony Sottile
567cafc15a
py310+
2025-10-16 10:01:02 -04:00
Max R
5fab0d1887
Update hooks and use autopep8 + add-trailing-comma instead of black
2025-07-20 19:13:24 -04:00
anthony sottile
4941a3e32e
upgrade pyflakes / pycodestyle
2025-06-20 15:15:53 -04:00
anthony sottile
019424b80d
add support for t-strings
2025-05-23 16:25:06 -04:00
Anthony Sottile
fa2ed7145c
remove a few unnecessary mocks in test_checker_manager
...
noticed while implementing the --jobs limiter
2025-02-16 15:21:48 -05:00
Anthony Sottile
f35737a32d
avoid starting unnecessary processes when file count is limited
2025-02-16 13:29:05 -05:00
Stephen Finucane
bdcd5c2c0a
Handle escaped braces in f-strings
...
To use a curly brace in an f-string, you must escape it. For example:
>>> k = 1
>>> f'{{{k}'
'{1'
Saving this as a script and running the 'tokenize' module highlights
something odd around the counting of tokens:
❯ python -m tokenize wow.py
0,0-0,0: ENCODING 'utf-8'
1,0-1,1: NAME 'k'
1,2-1,3: OP '='
1,4-1,5: NUMBER '1'
1,5-1,6: NEWLINE '\n'
2,0-2,2: FSTRING_START "f'"
2,2-2,3: FSTRING_MIDDLE '{' # <-- here...
2,4-2,5: OP '{' # <-- and here
2,5-2,6: NAME 'k'
2,6-2,7: OP '}'
2,7-2,8: FSTRING_END "'"
2,8-2,9: NEWLINE '\n'
3,0-3,0: ENDMARKER ''
The FSTRING_MIDDLE character we have is the escaped/post-parse single
curly brace rather than the raw double curly brace, however, while our
end index of this token accounts for the parsed form, the start index of
the next token does not (put another way, it jumps from 3 -> 4). This
triggers some existing, unrelated code that we need to bypass. Do just
that.
Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes : #1948
2024-08-04 15:54:22 -04:00
Ian Stapleton Cordasco
b67ce03a4a
Fix bugbear lints
2023-12-20 06:54:05 -06:00
Anthony Sottile
1ed78d592a
handle multiline fstrings in 3.12
2023-07-29 14:33:10 -04:00
Anthony Sottile
43266a2e26
mute FSTRING_MIDDLE tokens
2023-06-12 22:02:26 -04:00
Anthony Sottile
837e81948b
communicate that --select is usually unnecessary
2022-12-14 12:55:37 -05:00
Anthony Sottile
489be4d30a
upgrade pyflakes to 3.0.0
2022-11-23 13:56:50 -05:00
Anthony Sottile
aa002ee4ed
require python 3.8.1+
2022-11-18 11:33:52 -05:00
Anthony Sottile
88457a0894
remove optparse support
2022-11-15 19:01:40 -05:00
lt94
314b9f5161
Raise exception if append-config does not exist
2022-11-07 19:06:48 -05:00
Menno Liefstingh
1346ddefd3
Adds warning when invalid error codes are parsed for ignore or extend-ignore from config file
2022-11-07 18:51:06 -05:00
Anthony Sottile
7a094fa826
ensure results are sorted for file traversal
2022-10-30 15:11:56 -04:00
Anthony Sottile
0d667a7329
enable multiprocessing on other platforms
2022-10-26 22:23:02 -07:00
Anthony Sottile
fba6df88f9
remove --diff option
2022-10-26 20:39:12 -07:00
Albert Tugushev
48b2919130
Display list of available formatters with help for --format
2022-10-15 15:39:05 -04:00
Anthony Sottile
e94fb10940
require python>=3.7
2022-08-05 19:51:08 -04:00
Anthony Sottile
25e8ff18b3
ignore config files that partially parse as flake8 configs
2022-08-01 19:11:53 -04:00
Anthony Sottile
8b51ee4ea5
skip skipping home if home does not exist
2022-08-01 05:51:38 -07:00
Anthony Sottile
fce93b952a
prevent duplicate plugin discovery on misconfigured pythons
...
for example, `venv`-virtualenvs on fedora have both `lib` and `lib64` on
`sys.path` despite them being the same. this causes
`importlib.metadata.distributions` to double-discover.
```console
$ docker run --rm -t fedora:latest bash -c 'dnf install -qq -y python3 >& /dev/null && python3 -m venv venv && venv/bin/pip -qq install cfgv && venv/bin/python - <<< "from importlib.metadata import distributions; print(len([d for d in distributions() if d.name == '"'"'cfgv'"'"']))"'
2
```
2022-07-31 18:03:25 -04:00
Anthony Sottile
c7c6218e58
Release 5.0.0
2022-07-30 17:00:41 -04:00
Anthony Sottile
14a91d995c
ignore config files in the home directory
2022-07-13 15:40:40 -04:00
Anthony Sottile
367c810f0e
don't consider default codes as explicitly selected unless listed
2022-06-24 17:55:41 -04:00
Anthony Sottile
f3443f4a78
forbid invalid plugin prefixes in plugin loading
2022-04-06 16:29:25 -04:00
Anthony Sottile
c5225db626
simplify decision engine
...
- not specified codes (cmdline / config) are now known as being implicit via
None sentinel
- removed redundant logic for (explicit, explicit) selection
2022-03-22 18:22:20 -07:00
Anthony Sottile
62ce3e4918
Merge pull request #1552 from PyCQA/ignore-order
...
make --ignore order consistent
2022-02-06 11:39:46 -05:00
Anthony Sottile
f7ef1a6c8b
make --ignore order consistent
2022-02-06 08:36:36 -08:00
Anthony Sottile
58ade57ca2
re-show pycodestyle in help after plugin gen
2022-02-06 08:14:26 -08:00
Anthony Sottile
4e56fc0f6a
pregenerate the pycodestyle plugin to avoid call overhead
2022-01-25 13:52:54 -05:00
Anthony Sottile
d2333c4471
include the file path in the plugin execution error
2022-01-23 20:41:32 -05:00
Anthony Sottile
f0f71fc179
remove unused parameter from make_formatter
2022-01-23 19:33:21 -05:00
Anthony Sottile
f9eb0fd6ea
change keyword_arguments_for so it does not modify and return
2022-01-23 19:06:06 -05:00
Anthony Sottile
929cf5dfd3
remove log_token and EXTRA_VERBOSE
...
- flake8 spent 5% of execution in `log_token`
- `EXTRA_VERBOSE` was only used by `log_token`
- `python -m tokenize` provides better debug token output
2022-01-23 18:08:58 -05:00
Anthony Sottile
23a60dd902
use the actual line contents when processing physical lines
2022-01-22 15:27:53 -05:00
Anthony Sottile
d03b9c97cc
add a --require-plugins option
2022-01-22 14:08:32 -05:00
Anthony Sottile
9d23faad6d
always use UTF-8 encoding when reading configuration
2022-01-20 14:03:18 -05:00
Anthony Sottile
c194d6cc30
combine local_plugin_paths and parse_plugin_options
2022-01-18 20:57:09 -05:00
Anthony Sottile
1b58293ad3
refactor plugin loading options to prepare for --require-plugins
2022-01-10 20:06:26 -05:00
Anthony Sottile
ec57d5e67c
use tokenize.TokenInfo instead of _Token alias
2022-01-05 15:37:25 -05:00
Anthony Sottile
fa4c31fb97
break type checking cycles
2022-01-05 13:40:16 -05:00
Anthony Sottile
3c885219b5
use typesafe NamedTuple
2022-01-05 13:02:38 -05:00
Anthony Sottile
78b2db4072
type the rest of the legacy api
2022-01-05 12:35:38 -05:00
Anthony Sottile
4cb1dc8c44
perform path normalization on '.'
2022-01-05 11:44:31 -05:00
Anthony Sottile
b62edd334a
fix extended_default_select from plugin loading
2022-01-01 19:26:43 -05:00
Anthony Sottile
a8333e2bf2
move managing of off_by_default / enable_extensions to plugin loading
2022-01-01 18:33:07 -05:00
Anthony Sottile
50d69150c1
rework plugin loading
2021-12-31 15:09:54 -08:00