Closed jakkdl closed 1 year ago
sad, I wrote and confirmed that a version with ast.unparse
, removing construct_name
completely, works perfectly with current tests - until 3.8 came and spoiled all the fun.
Looks good so far! How much would break if we just declared that 3.8 was only best-effort support? I don't really mind requiring 3.9+ to run the linter, now that 3.11 is out.
My (weakish) preference for ->
over :
is that the latter often has special meaning in config file formats, or can be confused with attribute/member lookup from other languages. ->
to me reads more directly as "replace with" but I'm open to arguments against!
For just this change it would break 107 and 108 with a user-configured decorator, 200, and almost certainly all other 2xx messages. But there's generally some developing overhead to account for 3.8, since the AST has changed since then (e.g. https://github.com/PyCQA/flake8-bugbear/blob/main/bugbear.py#L683-L689) so it can sometimes be a non-insignificant overhead to debug issues caused by it, and even if that's just a matter of skipping broken tests you'd still have to figure out where/why/how it breaks and insert skips, and also update tests to skip it. So I personally wouldn't complain if we stopped testing on it entirely (and running the full test suite would be faster, yay!).
My (weakish) preference for
->
over:
is that the latter often has special meaning in config file formats, or can be confused with attribute/member lookup from other languages.->
to me reads more directly as "replace with" but I'm open to arguments against!
Makes sense. I'm mostly just colored by mentally parsing it as a dict, and seeing ->
just looks a bit weird. But since we don't require {}
so it's not a proper dict it's maybe a bad idea to reinforce the idea that it's parsed into one under the hood.
fixed todo's, changed fnmatch_qualified_name
and started messing with disabling tests for 3.8 - but now it fails because of test coverage, so would need to configure --no-cov
only when checking py38...
Fixed all comments, needed to split a couple lines that were long - and realized I've been inconsistent whether spaces should be at the start of the new line or at the end of the previous. Didn't find any great source on what's the preferred style, but seems like trailing space is more common. (Something for Black?)
shed also went ahead with a bunch of changes (though removing Union
from trio107 it didn't do until I experimented with --py311-plus
despite it working perfectly fine with py39).
I also managed to get rid of all pragma: no cover
in the whole codebase (:tada:), partly thanks to pyright no longer checking the test files so I can do highly illegal stuff.
Ran a --runslow
as well to check that I didn't mess anything up.
Implements the config option in #58 This ended up touching surprisingly many spots in various places, most of them unintentionally. So sorry for the diff being a bit sprawling. Going through the diff and explaining all changes:
[flake8_trio.py]
fnmatch_qualified_name
for that to work smoothly, which doesn't affect the decorator matching using it.:
as the splitter if it was me, but easily configurable inParseDict
.f{var!r}
I couldn't resist adding it toListOfIdentifiers
as well ^^;[pyproject.toml]
[tests/test_decorator.py]
test_xxx_options
intest_flake8_trio.py
[tests/test_flake8_trio.py]
# ARGS
construct in a test file to specify command line flags to be used when running the file.test_113_options
andtest_114_options
could be cleaned up given this new functionality. Leaving that for a later PR though.test_200_options
, partly because testing is good:tm:, but in large part because I wanted to silence them in my CLI even when running with-s
. So added that totest_114_options
as well.TODO: