wemake-python-styleguide icon indicating copy to clipboard operation
wemake-python-styleguide copied to clipboard

WPS440 is wrong in compat shim modules

Open webknjaz opened this issue 5 years ago • 1 comments

Bug report

What's wrong

When having compat shims, this happens:

# _compat.py:
try:
    from subprocess import CompletedProcess  # noqa: S404, WPS433
except ImportError:
    class CompletedProcess:
        ...
src/ZZZ/_compat.py:30:5: WPS440 Found block variables overlap: CompletedProcess

This is wrong because the except block will create an object only if try failed so there's 100% no overlapping.

How is that should be

No error

System information

flake8 information

v3.8.0a2

pip information

(doesn't really matter and it's under pre-commit so hard to reach)

webknjaz avatar May 06 '20 21:05 webknjaz

Yes, I confirm: this is really annoying.

sobolevn avatar May 06 '20 22:05 sobolevn