mCodingLLC / VideosSampleCode

Code from the mCoding sample videos
MIT License
952 stars 198 forks source link

Video 89: code broke with flake8 version 5.0.0 #15

Closed JeroenBos closed 2 years ago

JeroenBos commented 2 years ago

The example of video 89 doesn't work anymore with flake8 versions 5.0.0-5.0.2. I confirmed I can get desired behavior with version 4.0.1. The requirements.txt in video 89 lists flake8>=4.0, but to be correct that should be changed to flake8>=4.0<5

To reproduce the breaking change just install flake8 (which will install version 5+):

$ cd videos/089_custom_linting_with_ast
$ flake8 .
There was a critical error during execution of Flake8:
plugin code for `local[MCOD1]` does not match ^[A-Z]{1,3}[0-9]{0,3}$

Expected was no critical error.


Nowhere does local[MCOD1] occur, so my bet's on a bug in flake8. Some extra information on my actual setup on which I encountered the bug:

$ flake8 --version
5.0.0 (mccabe: 0.7.0, pycodestyle: 2.9.0, pyflakes: 2.5.0) CPython 3.10.4 on Windows
JeroenBos commented 2 years ago

I just realized this may have been a bit too preliminary to report to you. I only now realize that 5.0.0 is only 2 days old, and in fact the authors seem to be in a bit of a desperate patching frenzy as there's been 2 more updates since, the last one one hour ago. Maybe they'll fix it in 5.0.3.

mCodingLLC commented 2 years ago

Thanks for bringing this up. The error is because they appear to be enforcing the regex ^[A-Z]{1,3}[0-9]{0,3}$ on the error code. In particular the error code must start with 1-3 letters, but MCOD1 starts with 4 letters. I will raise this issue on flake8's issues page before trying to correct it here as perhaps they may allow 4 letter codes if I ask nicely.

mCodingLLC commented 2 years ago

See: https://github.com/PyCQA/flake8/issues/1643

JeroenBos commented 2 years ago

@mCodingLLC Thank you. Your effort has cleared up my understanding.

I'm sorry to read that you were received so harshly.