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

False positive WPS122 when using _ in a for loop #1887

Closed
ramast opened this issue Feb 18, 2021 · 2 comments
Closed

False positive WPS122 when using _ in a for loop #1887

ramast opened this issue Feb 18, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@ramast
Copy link

ramast commented Feb 18, 2021

Bug report

What's wrong

    for _ in range(10):
        print('hello')

test.py:1:1: WPS122 Found all unused variables definition: _

How it should be

Using _ inside for loop is actually recommended by WPS123 so it shouldn't be an error.

System information

Linux localhost 5.4.72-gentoo #6 SMP Fri Oct 23 11:12:21 EET 2020 x86_64 Intel(R) Core(TM) i7-3517U CPU @ 1.90GHz GenuineIntel GNU/Linux

flake8 information

{
  "dependencies": [],
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.7.9",
    "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.5.8"
    },
    {
      "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": "flake8_simplify",
      "version": "0.8.0"
    },
    {
      "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": "rst-docstrings",
      "version": "0.0.12"
    },
    {
      "is_local": false,
      "plugin": "wemake_python_styleguide",
      "version": "0.14.1"
    }
  ],
  "version": "3.8.4"
}

pip information

Contents of pip freeze:

amqp==2.5.2
anyjson==0.3.3
appdirs==1.4.4
aspy.yaml==1.3.0
astor==0.8.1
astroid==2.4.2
attrs==19.2.0
backcall==0.2.0
backoff==1.6.0
bandit==1.7.0
bcrypt==3.2.0
beautifulsoup4==4.6.0
billiard==3.6.1.0
blinker==1.4
boto==2.38.0
boto3==1.9.231
boto3-stubs==1.16.59.0
botocore==1.12.231
celery==4.3.0
certifi==2020.12.5
cffi==1.14.4
cfgv==3.2.0
chardet==3.0.4
cryptography==3.3.1
darglint==1.5.8
decorator==4.4.2
distlib==0.3.1
dj-inmemorystorage==1.4.0
Django==1.11.17
django-appconf==1.0.4
django-celery-results==1.0.1
-e git+https://gitlab.social-net.me/open/django-colorfield.git@7d6e24dcdfbc33431cd63f2c9f9f7f51902dae2f#egg=django_colorfield
django-compressor==2.2
django-cookies-samesite==0.2.0
django-cors-headers==2.4.0
-e git+https://gitlab.social-net.me/open/django-datefilterspec.git@5d857645151a7cfd0d4a5e2ae6677b73696583de#egg=django_daterange_filter
django-debug-toolbar==1.4
django-environ==0.4.5
django-extensions==2.0.7
django-filter==2.0.0
django-hvad==1.8.0
django-imagekit==4.0
django-jsonfield==1.0.0
django-libsass==0.8
django-libsass-compass-mixins==0.12.10
django-multiselectfield==0.1.8
django-nose==1.4.6
django-picklefield==1.0.0
django-redis==4.5.0
django-rosetta==0.7.13
django-storages==1.6.6
django-user-agents==0.3.2
django-webpack-loader==0.7.0
djangorestframework==3.9.4
docutils==0.12
ecdsa==0.13
eradicate==1.0
Fabric3==1.14.post1
factory-boy==2.11.1
Faker==5.3.0
filelock==3.0.12
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-simplify==0.8.0
flake8-string-format==0.2.3
freezegun==0.3.14
futures==2.2.0
gitdb==4.0.5
GitPython==3.1.11
identify==1.5.11
idna==2.8
importlib-metadata==3.3.0
iniconfig==1.1.1
ipython==7.19.0
ipython-genutils==0.2.0
isort==4.3.20
jedi==0.17.2
jmespath==0.7.1
jsonpickle==1.4.2
jsonschema==3.2.0
kombu==4.6.7
lazy-object-proxy==1.4.3
libsass==0.19.4
Markdown==3.1.1
mccabe==0.6.1
microsofttranslator==0.7
mock==2.0.0
mysqlclient==1.4.4
newrelic==3.0.0.89
nodeenv==1.5.0
nose==1.3.7
nose-timer==0.7.5
oauthlib==0.7.2
packaging==20.8
paramiko==2.7.1
parso==0.7.1
pbr==5.5.1
pep8-naming==0.9.1
pexpect==4.8.0
pickleshare==0.7.5
pilkit==2.0
Pillow==2.7.0
pipdeptree==0.13.2
pluggy==0.13.1
polib==1.0.6
pre-commit==1.18.1
prompt-toolkit==3.0.8
ptyprocess==0.7.0
py==1.10.0
pycallgraph==1.0.1
pycodestyle==2.6.0
pycparser==2.20
pycryptodome==3.9.0
pydocstyle==5.1.1
pyflakes==2.2.0
Pygments==2.7.3
pylint==2.6.0
PyNaCl==1.4.0
pyparsing==2.4.7
pyrsistent==0.17.3
pytest==6.2.1
pytest-django==4.1.0
python-dateutil==2.4.2
python-gitlab==2.3.1
python-memcached==1.59
python-openid==2.2.5
pytz==2019.3
pyuploadcare==2.2.1
PyYAML==5.3.1
raygun4py==3.1.5
rcssmin==1.0.6
redis==3.5.3
requests==2.22.0
requests-mock==1.2.0
requests-oauthlib==0.5.0
responses==0.10.6
restructuredtext-lint==1.3.2
rjsmin==1.0.12
s3transfer==0.2.1
six==1.12.0
smmap==3.0.4
snowballstemmer==2.0.0
sorl-thumbnail==12.2
sqlparse==0.1.19
statsd==3.2.2
stevedore==3.3.0
testfixtures==6.17.0
text-unidecode==1.3
toml==0.10.2
tox==3.14.0
traitlets==5.0.5
typed-ast==1.4.2
typing-extensions==3.7.4.3
ua-parser==0.3.6
unicode-slugify==0.1.3
Unidecode==0.4.17
uritemplate==3.0.1
urllib3==1.25.11
user-agents==0.3.2
uWSGI==2.0.18
vine==1.3.0
virtualenv==20.2.2
wcwidth==0.2.5
wemake-python-styleguide==0.14.1
Werkzeug==0.11.2
wrapt==1.12.1
zipp==3.4.0

@ramast ramast added the bug Something isn't working label Feb 18, 2021
@nnuzaba
Copy link
Contributor

nnuzaba commented Mar 2, 2021

Should be fixed in latest version. See #1406

@sobolevn sobolevn closed this as completed Mar 2, 2021
@sobolevn
Copy link
Member

sobolevn commented Mar 2, 2021

@nnuzaba thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants