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

WPS472 only detecting one pure variable assignment #2301

Closed
Clemens-Kialo opened this issue Dec 16, 2021 · 2 comments · Fixed by #2343
Closed

WPS472 only detecting one pure variable assignment #2301

Clemens-Kialo opened this issue Dec 16, 2021 · 2 comments · Fixed by #2343
Labels
bug Something isn't working good first issue Entrypoint to the project help wanted Extra attention is needed level:starter Good for newcomers

Comments

@Clemens-Kialo
Copy link

Clemens-Kialo commented Dec 16, 2021

What's wrong

WPS472 detects name, *_ = get_address().
When it comes to slightly more complex value assignments, it does not work:

  1. names[0], *_ = get_address()
  2. self.name, *_ = get_address()
  3. (name, street), *_ = get_address()

Also when extracting a second (or more values) the detection fails:

  1. name, street, *_ = get_address()
  2. name, _, city, *_ = get_address()
  3. name, _, self.city, *_ = get_address()

How it should be

It would be nice if all of the examples would also be detected as WPS472 violations.

Flake8 version and plugins

{
"dependencies": [],
"platform": {
"python_implementation": "CPython",
"python_version": "3.9.6",
"system": "Darwin"
},
"plugins": [
{
"is_local": false,
"plugin": "flake8-bandit",
"version": "2.1.2"
},
{
"is_local": false,
"plugin": "flake8-broken-line",
"version": "0.3.0"
},
{
"is_local": false,
"plugin": "flake8-bugbear",
"version": "20.11.1"
},
{
"is_local": false,
"plugin": "flake8-comprehensions",
"version": "3.4.0"
},
{
"is_local": false,
"plugin": "flake8-darglint",
"version": "1.8.0"
},
{
"is_local": false,
"plugin": "flake8-debugger",
"version": "4.0.0"
},
{
"is_local": false,
"plugin": "flake8-docstrings",
"version": "1.6.0, pydocstyle: 6.0.0"
},
{
"is_local": false,
"plugin": "flake8-eradicate",
"version": "1.0.0"
},
{
"is_local": false,
"plugin": "flake8-string-format",
"version": "0.3.0"
},
{
"is_local": false,
"plugin": "flake8.datetimez",
"version": "20.10.0"
},
{
"is_local": false,
"plugin": "flake8_commas",
"version": "2.0.0"
},
{
"is_local": false,
"plugin": "flake8_isort",
"version": "4.0.0"
},
{
"is_local": false,
"plugin": "flake8_quotes",
"version": "3.2.0"
},
{
"is_local": false,
"plugin": "mccabe",
"version": "0.6.1"
},
{
"is_local": false,
"plugin": "naming",
"version": "0.11.1"
},
{
"is_local": false,
"plugin": "pycodestyle",
"version": "2.7.0"
},
{
"is_local": false,
"plugin": "pyflakes",
"version": "2.3.0"
},
{
"is_local": false,
"plugin": "rst-docstrings",
"version": "0.2.3"
},
{
"is_local": false,
"plugin": "wemake_python_styleguide",
"version": "0.16.0"
}
],
"version": "3.9.2"
}

pip information

pip 21.3.1

OS information

macOS Monterey
Version 12.0.1

@Clemens-Kialo Clemens-Kialo added the bug Something isn't working label Dec 16, 2021
@sobolevn sobolevn added good first issue Entrypoint to the project help wanted Extra attention is needed level:starter Good for newcomers labels Jan 29, 2022
@sobolevn
Copy link
Member

Thanks! @Clemens-Kialo I hope to fix it in 0.16.1

@sobolevn sobolevn added this to the Version 0.16.x milestone Jan 29, 2022
@sobolevn
Copy link
Member

Just to clarify, cases like name, street, *_ = get_address() are ok, because we only forbid getting first and last items implicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Entrypoint to the project 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