Using the sample code from the help page:
price_in_euro = 3.33 # could be changed later
total = get_items_from_cart() * price_in_euro
Returns Z432 as error code
Same for any other piece of code like this:
foo = 19091
do(foo)
Returns Z432 as error code
This piece of code should not raise Z432 because the number was assigned to a variable.
Contents of flake8 --bug-report:
PS C:\Python36\Scripts> C:\Temp\SampleEnv\Scripts\flake8.exe --bug-report
{
"dependencies": [
{
"dependency": "setuptools",
"version": "39.0.1"
}
],
"platform": {
"python_implementation": "CPython",
"python_version": "3.6.6",
"system": "Windows"
},
"plugins": [
{
"is_local": false,
"plugin": "flake8-bandit",
"version": "v1.0.2"
},
{
"is_local": false,
"plugin": "flake8-broken-line",
"version": "0.1.0"
},
{
"is_local": false,
"plugin": "flake8-bugbear",
"version": "18.8.0"
},
{
"is_local": false,
"plugin": "flake8-comprehensions",
"version": "1.4.1"
},
{
"is_local": false,
"plugin": "flake8-debugger",
"version": "3.1.0"
},
{
"is_local": false,
"plugin": "flake8-docstrings",
"version": "1.3.0, pydocstyle: 2.1.1"
},
{
"is_local": false,
"plugin": "flake8-eradicate",
"version": "0.1.1"
},
{
"is_local": false,
"plugin": "flake8-string-format",
"version": "0.2.3"
},
{
"is_local": false,
"plugin": "flake8-type-annotations",
"version": "0.1.0"
},
{
"is_local": false,
"plugin": "flake8_builtins",
"version": "1.4.1"
},
{
"is_local": false,
"plugin": "flake8_coding",
"version": "1.3.1"
},
{
"is_local": false,
"plugin": "flake8_commas",
"version": "2.0.0"
},
{
"is_local": false,
"plugin": "flake8_isort",
"version": "2.3"
},
{
"is_local": false,
"plugin": "flake8_pep3101",
"version": "1.2.1"
},
{
"is_local": false,
"plugin": "flake8_quotes",
"version": "1.0.0"
},
{
"is_local": false,
"plugin": "logging-format",
"version": "0.5.0"
},
{
"is_local": false,
"plugin": "mccabe",
"version": "0.6.1"
},
{
"is_local": false,
"plugin": "naming",
"version": "0.7.0"
},
{
"is_local": false,
"plugin": "pycodestyle",
"version": "2.3.1"
},
{
"is_local": false,
"plugin": "pyflakes",
"version": "1.6.0"
},
{
"is_local": false,
"plugin": "wemake-python-styleguide",
"version": "0.2.0"
}
],
"version": "3.5.0"
}
Contents of pip freeze:
PS C:\Python36\Scripts> pip freeze
autopep8==1.4
CacheControl==0.12.5
cachy==0.2.0
certifi==2018.8.24
chardet==3.0.4
cleo==0.6.8
html5lib==1.0.1
idna==2.7
jsonschema==2.6.0
lockfile==0.12.2
msgpack==0.5.6
pastel==0.1.0
pkginfo==1.4.2
poetry==0.11.5
pycodestyle==2.4.0
pylev==1.3.0
pyparsing==2.2.2
pyrsistent==0.14.4
requests==2.19.1
requests-toolbelt==0.8.0
shellingham==1.2.6
six==1.11.0
tomlkit==0.4.4
urllib3==1.23
webencodings==0.5.1
yapf==0.24.0
That's a very strange behavior. Since I can not reproduce it.
» cat tests/fixtures/noqa.py
price_in_euro = 3.33 # could be changed later
total = get_items_from_cart() * price_in_euro
(.venv) ~/Documents/github/wemake-python-styleguide master ✗
» flake8 tests/fixtures/noqa.py
tests/fixtures/noqa.py:0:1: C101 Coding magic comment not found
tests/fixtures/noqa.py:1:1: D100 Missing docstring in public module
tests/fixtures/noqa.py:2:9: F821 undefined name 'get_items_from_cart'
We also have a test case for this:
https://github.com/wemake-services/wemake-python-styleguide/blob/master/tests/test_visitors/test_ast/test_numbers/test_magic_numbers.py#L15-L26
The correct usages are covered.
@AlexArcPy do you have the same issue with the master version?
@sobolevn , same issue with the master... but tested on Ubuntu - no issue is raised. What the heck is wrong with my Windows 10...
@AlexArcPy can you please try to figure it out? We have tests running on Windows: https://github.com/wemake-services/wemake-python-styleguide/blob/master/appveyor.yml
Can you reproduce tests behavior?
I am always scared by this OS.
Sure, will try to dig to see if I find anything. Yes, I am able to see this error raised on Windows 10 machine with the latest linter installed. Will post here if I find anything worth sharing.
@AlexArcPy is this still an issue?
I've tried various things but this seems to be specific to my Windows 10 environment. Since if I understood it right the appveyor tests on Windows pass, this issue could be closed and no further action is required in this regard.