I don't know if this is the right repo for this issue but my best guess is that it is.
I'm using pre-commit.com too and I have an upstream flake8 hook set up. I've added flake8-eradicate>=1.0.0
and wemake-python-styleguide
there. That seemed to work fine in local envs of developers under different OSs.
But in GitHub Actions CI/CD something shady started happening, something quite unobvious and hard to debug. I suspected that some flake8 plugins misbehave but I had no idea which ones.
flake8 started failing with violations that were supposed to be ignored in the config. It wasn't really obvious in the CI because I used the wemake formatter and it somehow didn't show the error messages, only some lines from code.
Example: https://github.com/ansible/pylibssh/runs/1566735649?check_suite_focus=true#step:11:31
I had to break into those GHA runner VMs over SSH using https://github.com/marketplace/actions/debugging-with-tmate to gather more intel!
Commenting out #format = wemake
revealed another unexpected detail — almost all of those error messages had error codes prefixed with a letter they weren't supposed to use — Z
. Things like these came up:
tests/conftest.py:14:1: Z101 Found nested import "pylibsshext.session"
from pylibsshext.session import Session
^
tests/conftest.py:44:9: Z111 Found bare raise outside of except "raise" raise
^
tests/conftest.py:122:9: Z110 Found wrong keyword "del"
del ssh_session # noqa: WPS420
^
I've commented out the flake8-eradicate>=1.0.0
line and it reported no violations when the version required by wemake-python-styleguide, which is flake8-eradicate (>=0.3,<0.4)
(ref https://pypi.org/pypi/wemake-python-styleguide/json), was used.
I confirmed that when I tried to re-add flake8-eradicate>=1.0.0
, it started throwing errors at me again. Then, I removed the wemake-python-styleguide
line keeping flake8-eradicate>=1.0.0
in place and that worked too.
STR: fork https://github.com/ansible/pylibssh/tree/55b241a001c3621d68776f244a46650bfa5590f9, stick https://github.com/ansible/pylibssh/commit/b4f27eaac023ed8164f14128c85ce97b0e3fda1c there and connect over SSH to see the env.
N.B. I have no clue why but it's only happening under the GitHub Actions VMs and not locally (checked under CPython 3.8 and 3.9).