wemake-python-styleguide
wemake-python-styleguide copied to clipboard
False positive WPS417
What's wrong
I have this minimal reproducible example which has several WPS417 violations
def main():
some_dict = {
-2: 'A',
-1: 'B',
0: 'C',
1: 'D',
2: 'E',
}
print(some_dict)
some_set = {-2, -1, 0, 1, 2}
print(some_set)
if __name__ == '__main__':
main()
but they shouldn't be there.
flake8's output:
(.venv) ilya.vlasov@AM-UNIT-0094 wps_bug % flake8 . --exclude .venv
./main.py:1:1: D100 Missing docstring in public module
./main.py:1:1: D103 Missing docstring in public function
./main.py:2:17: WPS417 Found non-unique item in hash: 1
./main.py:2:17: WPS417 Found non-unique item in hash: 2
./main.py:10:5: WPS421 Found wrong function call: print
./main.py:12:16: WPS417 Found non-unique item in hash: 1
./main.py:12:16: WPS417 Found non-unique item in hash: 2
./main.py:13:5: WPS421 Found wrong function call: print
How it should be
I expect this code to have no WPS417 violations
Flake8 version and plugins
{
"platform": {
"python_implementation": "CPython",
"python_version": "3.9.6",
"system": "Darwin"
},
"plugins": [
{
"plugin": "darglint",
"version": "1.8.1"
},
{
"plugin": "flake8-bandit",
"version": "4.1.1"
},
{
"plugin": "flake8-broken-line",
"version": "1.0.0"
},
{
"plugin": "flake8-bugbear",
"version": "23.7.10"
},
{
"plugin": "flake8-commas",
"version": "2.1.0"
},
{
"plugin": "flake8-comprehensions",
"version": "3.14.0"
},
{
"plugin": "flake8-debugger",
"version": "4.1.2"
},
{
"plugin": "flake8-docstrings",
"version": "1.7.0"
},
{
"plugin": "flake8-eradicate",
"version": "1.5.0"
},
{
"plugin": "flake8-isort",
"version": "6.0.0"
},
{
"plugin": "flake8-quotes",
"version": "3.3.2"
},
{
"plugin": "flake8-rst-docstrings",
"version": "0.3.0"
},
{
"plugin": "flake8-string-format",
"version": "0.3.0"
},
{
"plugin": "mccabe",
"version": "0.7.0"
},
{
"plugin": "pep8-naming",
"version": "0.13.3"
},
{
"plugin": "pycodestyle",
"version": "2.11.0"
},
{
"plugin": "pyflakes",
"version": "3.1.0"
},
{
"plugin": "wemake-python-styleguide",
"version": "0.18.0"
}
],
"version": "6.1.0"
}
pip information
pip 21.2.4 from /Users/ilya.vlasov/Documents/wps_bug/.venv/lib/python3.9/site-packages/pip (python 3.9) astor==0.8.1 attrs==23.1.0 bandit==1.7.5 darglint==1.8.1 docutils==0.20.1 eradicate==2.3.0 flake8==6.1.0 flake8-bandit==4.1.1 flake8-broken-line==1.0.0 flake8-bugbear==23.7.10 flake8-commas==2.1.0 flake8-comprehensions==3.14.0 flake8-debugger==4.1.2 flake8-docstrings==1.7.0 flake8-eradicate==1.5.0 flake8-isort==6.0.0 flake8-quotes==3.3.2 flake8-rst-docstrings==0.3.0 flake8-string-format==0.3.0 gitdb==4.0.10 GitPython==3.1.32 isort==5.12.0 markdown-it-py==3.0.0 mccabe==0.7.0 mdurl==0.1.2 pbr==5.11.1 pep8-naming==0.13.3 pycodestyle==2.11.0 pydocstyle==6.3.0 pyflakes==3.1.0 Pygments==2.16.1 PyYAML==6.0.1 restructuredtext-lint==1.4.0 rich==13.5.2 smmap==5.0.0 snowballstemmer==2.2.0 stevedore==5.1.0 typing_extensions==4.7.1 wemake-python-styleguide==0.18.0
OS information
ProductName: macOS ProductVersion: 13.4.1 ProductVersionExtra: (c) BuildVersion: 22F770820d