Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reassigning variable to itself error (WPS434) false positive #1874

Closed
impadalko opened this issue Feb 12, 2021 · 1 comment · Fixed by #2070
Closed

Reassigning variable to itself error (WPS434) false positive #1874

impadalko opened this issue Feb 12, 2021 · 1 comment · Fixed by #2070
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed level:starter Good for newcomers

Comments

@impadalko
Copy link

Bug report

What's wrong

Flake8 fails on the following code with the error: WPS434 Found reassigning variable to itself: dx

$ cat test1.py 
"""Incorrect test."""

dx, dy = -dy, dx
$ flake8 test1.py 
test1.py:3:1: WPS434 Found reassigning variable to itself: dx

However, flake8 passes when changing the order of the assignments

$ cat test2.py 
"""Correct test."""

dy, dx = dx, -dy
$ flake8 test2.py
(No output)

How it should be

There is no reassignment, the first case should also pass this rule.

System information

flake8 information

{
  "dependencies": [],
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.8.5",
    "system": "Linux"
  },
  "plugins": [
    {
      "is_local": false,
      "plugin": "flake8-bandit",
      "version": "2.1.2"
    },
    {
      "is_local": false,
      "plugin": "flake8-broken-line",
      "version": "0.2.1"
    },
    {
      "is_local": false,
      "plugin": "flake8-bugbear",
      "version": "19.8.0"
    },
    {
      "is_local": false,
      "plugin": "flake8-comprehensions",
      "version": "3.3.1"
    },
    {
      "is_local": false,
      "plugin": "flake8-darglint",
      "version": "1.6.0"
    },
    {
      "is_local": false,
      "plugin": "flake8-debugger",
      "version": "3.2.1"
    },
    {
      "is_local": false,
      "plugin": "flake8-docstrings",
      "version": "1.5.0, pydocstyle: 5.1.1"
    },
    {
      "is_local": false,
      "plugin": "flake8-eradicate",
      "version": "0.3.0"
    },
    {
      "is_local": false,
      "plugin": "flake8-string-format",
      "version": "0.2.3"
    },
    {
      "is_local": false,
      "plugin": "flake8_commas",
      "version": "2.0.0"
    },
    {
      "is_local": false,
      "plugin": "flake8_isort",
      "version": "3.0.1"
    },
    {
      "is_local": false,
      "plugin": "flake8_quotes",
      "version": "2.1.2"
    },
    {
      "is_local": false,
      "plugin": "mccabe",
      "version": "0.6.1"
    },
    {
      "is_local": false,
      "plugin": "naming",
      "version": "0.9.1"
    },
    {
      "is_local": false,
      "plugin": "pycodestyle",
      "version": "2.6.0"
    },
    {
      "is_local": false,
      "plugin": "pyflakes",
      "version": "2.2.0"
    },
    {
      "is_local": false,
      "plugin": "radon",
      "version": "4.3.2"
    },
    {
      "is_local": false,
      "plugin": "rst-docstrings",
      "version": "0.0.12"
    },
    {
      "is_local": false,
      "plugin": "wemake_python_styleguide",
      "version": "0.14.1"
    }
  ],
  "version": "3.8.4"
}

pip information

add-trailing-comma==2.0.1
apturl==0.5.2
astor==0.8.1
attrs==20.3.0
autopep8==1.5.4
backcall==0.2.0
bandit==1.7.0
blinker==1.4
boto3==1.16.63
botocore==1.19.63
cachetools==4.2.1
catfish==1.4.13
certifi==2019.11.28
cffi==1.14.4
chardet==3.0.4
Click==7.0
colorama==0.4.3
command-not-found==0.3
cryptography==2.8
cupshelpers==1.0
darglint==1.6.0
dbus-python==1.2.16
decorator==4.4.2
defer==1.0.6
distro==1.4.0
distro-info===0.23ubuntu1
docutils==0.16
ecdsa==0.16.1
entrypoints==0.3
enum34==1.1.6
eradicate==1.0
fake-bpy-module-2.90==20200907
flake8==3.8.4
flake8-bandit==2.1.2
flake8-broken-line==0.2.1
flake8-bugbear==19.8.0
flake8-commas==2.0.0
flake8-comprehensions==3.3.1
flake8-debugger==3.2.1
flake8-docstrings==1.5.0
flake8-eradicate==0.3.0
flake8-isort==3.0.1
flake8-polyfill==1.0.2
flake8-quotes==2.1.2
flake8-rst-docstrings==0.0.12
flake8-string-format==0.2.3
future==0.18.2
gitdb==4.0.5
GitPython==3.1.12
google-api-core==1.25.1
google-api-python-client==1.12.8
google-auth==1.24.0
google-auth-httplib2==0.0.4
google-cloud-core==1.5.0
google-cloud-storage==1.32.0
google-crc32c==1.1.2
google-resumable-media==1.2.0
googleapis-common-protos==1.52.0
httplib2==0.18.1
idna==2.8
ipython==7.20.0
ipython-genutils==0.2.0
isort==4.3.5
jedi==0.18.0
Jinja2==2.11.2
jmespath==0.10.0
keyring==18.0.1
language-selector==0.1
launchpadlib==1.10.13
lazr.restfulclient==0.14.2
lazr.uri==1.0.3
lightdm-gtk-greeter-settings==1.2.2
mando==0.6.4
MarkupSafe==1.1.1
mccabe==0.6.1
menulibre==2.2.1
mugshot==0.4.2
mypy==0.790
mypy-extensions==0.4.3
netifaces==0.10.4
numpy==1.15.1
oauthlib==3.1.0
olefile==0.46
onboard==1.4.1
parso==0.8.1
pbr==5.5.1
pep8-naming==0.9.1
pexpect==4.6.0
pickleshare==0.7.5
Pillow==6.2.0
prompt-toolkit==3.0.14
protobuf==3.14.0
psutil==5.5.1
psycopg2-binary==2.8.2
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycairo==1.16.2
pycodestyle==2.6.0
pycparser==2.20
pycups==1.9.73
pydocstyle==5.1.1
pyflakes==2.2.0
Pygments==2.7.4
PyGObject==3.36.0
PyJWT==1.7.1
pymacaroons==0.13.0
PyNaCl==1.3.0
python-apt==2.0.0+ubuntu0.20.4.4
python-dateutil==2.7.3
python-debian===0.1.36ubuntu1
python-jose==3.1.0
pytz==2021.1
PyYAML==5.3.1
radon==4.3.2
reportlab==3.5.34
requests==2.24.0
requests-unixsocket==0.2.0
restructuredtext-lint==1.3.2
rsa==4.7
s3transfer==0.3.4
screen-resolution-extra==0.0.0
SecretStorage==2.3.1
sgt-launcher==0.2.5
simplejson==3.16.0
six==1.14.0
smmap==3.0.5
snowballstemmer==2.1.0
SQLAlchemy==1.3.8
stevedore==3.3.0
systemd-python==234
testfixtures==6.17.1
tokenize-rt==4.1.0
toml==0.10.2
traitlets==5.0.5
typed-ast==1.4.2
typing-extensions==3.7.4.3
ubuntu-advantage-tools==20.3
ubuntu-drivers-common==0.0.0
ufw==0.36
unify==0.5
untokenize==0.1.1
uritemplate==3.0.1
urllib3==1.25.8
validators==0.18.2
wadllib==1.3.3
wcwidth==0.2.5
wemake-python-styleguide==0.14.1
xcffib==0.8.1
xenon==0.7.1
xkit==0.0.0
@impadalko impadalko added the bug Something isn't working label Feb 12, 2021
@sobolevn
Copy link
Member

Thanks for the report!

It is related to: #1807

@sobolevn sobolevn self-assigned this Feb 12, 2021
@sobolevn sobolevn added help wanted Extra attention is needed level:starter Good for newcomers labels Apr 7, 2021
sobolevn added a commit that referenced this issue Jun 21, 2021
sobolevn added a commit that referenced this issue Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed level:starter Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants