python-trio / flake8-async

Highly opinionated linter for Trio code
https://flake8-async.readthedocs.io
MIT License
19 stars 2 forks source link

option for decorator to disable checkpoint checking #53

Closed jakkdl closed 2 years ago

jakkdl commented 2 years ago

flake8 for some reason freaks out about TRIO not being 3 characters when run through flake8.main.application.Application(), not sure if that's an issue somewhere on my end or in tox/pytest settings - tried updating everything in my virtualenv and wiping .tox but to no avail.

Modified the 108 check fixed in #42 to only be about entry/exit checking. Should probably be split into it's own PR, esp for ease of reverting if it does give a bunch of false alarms. Use the flag to disable checking them, upcoming new PR/issue to discuss how to check.

There's some alternatives for how to parse the disables. Should --no-checkpoint-warning-decorators=app disable on app.route, or should you require app.* or app.route (latter is current behaviour).

jakkdl commented 2 years ago

Finished!

I'm quite surprised we haven't hit an error for the plugin code being invalid previously. The test suite never involved actually running the plugin through flake8, but surely you've been doing that? Regardless, the documentation quite explicitly says that four-letter entry points are invalid.

Please Note: Your entry point does not need to be exactly 4 characters as of Flake8 3.0. Single letter entry point prefixes (such as the ‘X’ in the examples above) have caused issues in the past. As such, please consider using a 2 or 3 character entry point prefix, i.e., ABC is better than A but ABCD is invalid. A 3 letters entry point prefix followed by 3 numbers (i.e. ABC123 ) is currently the longest allowed entry point name.

https://flake8.pycqa.org/en/latest/plugin-development/registering-plugins.html

Changed the entry point to TRI for now, could also update all error messages to match.

Removed custom handling of asynccontextmanagers fully for now, you can get back previous functionality by adding it to the list of decorators disabling checks.