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

WPS432 should ignore numbers used as keyword arguments #2634

Open
Sxderp opened this issue Apr 20, 2023 · 0 comments
Open

WPS432 should ignore numbers used as keyword arguments #2634

Sxderp opened this issue Apr 20, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@Sxderp
Copy link
Contributor

Sxderp commented Apr 20, 2023

What's wrong

The "magic number" entry is to flag numbers that don't have an associated context / semantic meaning. I think keyword arguments are sufficiently semantic.

#!/usr/bin/python3

import time

def sleep_for(seconds):
    time.sleep(seconds)

sleep_for(seconds=12)

sleep.py:8:19: WPS432 Found magic number: 12

How it should be

Ignore numbers assigned via keyword arguments.

Flake8 version and plugins

{
"dependencies": [],
"platform": {
"python_implementation": "CPython",
"python_version": "3.9.14",
"system": "Linux"
},
"plugins": [
{
"is_local": false,
"plugin": "flake8-bandit",
"version": "3.0.0"
},
{
"is_local": false,
"plugin": "flake8-broken-line",
"version": "0.5.0"
},
{
"is_local": false,
"plugin": "flake8-bugbear",
"version": "22.12.6"
},
{
"is_local": false,
"plugin": "flake8-comprehensions",
"version": "3.12.0"
},
{
"is_local": false,
"plugin": "flake8-darglint",
"version": "1.8.1"
},
{
"is_local": false,
"plugin": "flake8-debugger",
"version": "4.1.2"
},
{
"is_local": false,
"plugin": "flake8-docstrings",
"version": "1.7.0, pydocstyle: 6.3.0"
},
{
"is_local": false,
"plugin": "flake8-eradicate",
"version": "1.4.0"
},
{
"is_local": false,
"plugin": "flake8-string-format",
"version": "0.3.0"
},
{
"is_local": false,
"plugin": "flake8_commas",
"version": "2.1.0"
},
{
"is_local": false,
"plugin": "flake8_isort",
"version": "4.2.0"
},
{
"is_local": false,
"plugin": "flake8_quotes",
"version": "3.3.2"
},
{
"is_local": false,
"plugin": "mccabe",
"version": "0.6.1"
},
{
"is_local": false,
"plugin": "naming",
"version": "0.13.2"
},
{
"is_local": false,
"plugin": "pycodestyle",
"version": "2.8.0"
},
{
"is_local": false,
"plugin": "pyflakes",
"version": "2.4.0"
},
{
"is_local": false,
"plugin": "rst-docstrings",
"version": "0.2.7"
},
{
"is_local": false,
"plugin": "wemake_python_styleguide",
"version": "0.17.0"
}
],
"version": "4.0.1"
}

pip information

pip 21.2.3 from /usr/lib/python3.9/site-packages/pip (python 3.9)
astor==0.8.1
attrs==23.1.0
bandit==1.7.5
chardet==4.0.0
darglint==1.8.1
dbus-python==1.2.18
decorator==4.4.2
docutils==0.19
eradicate==2.2.0
ethtool==0.15
flake8==4.0.1
flake8-bandit==3.0.0
flake8-broken-line==0.5.0
flake8-bugbear==22.12.6
flake8-commas==2.1.0
flake8-comprehensions==3.12.0
flake8-debugger==4.1.2
flake8-docstrings==1.7.0
flake8-eradicate==1.4.0
flake8-isort==4.2.0
flake8-polyfill==1.0.2
flake8-quotes==3.3.2
flake8-rst-docstrings==0.2.7
flake8-string-format==0.3.0
gitdb==4.0.10
GitPython==3.1.31
gpg==1.15.1
idna==2.10
iniparse==0.4
isort==5.12.0
libcomps==0.1.18
markdown-it-py==2.2.0
mccabe==0.6.1
mdurl==0.1.2
pbr==5.11.1
pep8-naming==0.13.2
pycodestyle==2.8.0
pydocstyle==6.3.0
pyflakes==2.4.0
Pygments==2.15.1
PyGObject==3.40.1
pyinotify==0.9.6
PySocks==1.7.1
python-dateutil==2.8.1
PyYAML==6.0
requests==2.25.1
restructuredtext-lint==1.4.0
rich==13.3.4
rpm==4.16.1.3
six==1.15.0
smmap==5.0.0
snowballstemmer==2.2.0
stevedore==5.0.0
subscription-manager==1.29.30.1
typing_extensions==4.5.0
urllib3==1.26.5
wemake-python-styleguide==0.17.0

OS information

Running a container. Basic Dockerfile:

FROM registry.access.redhat.com/ubi9
RUN yum -y update && yum -y install wget git-core python3 python3-pip file && yum clean all && \
    wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b /usr/local/bin/ && \
    pip-3 install --upgrade wemake-python-styleguide
# /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="9.1 (Plow)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="9.1"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Red Hat Enterprise Linux 9.1 (Plow)"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:redhat:enterprise_linux:9::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/9/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_BUGZILLA_PRODUCT_VERSION=9.1
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.1"
@Sxderp Sxderp added the bug Something isn't working label Apr 20, 2023
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

1 participant