Closed AlexArcPy closed 6 years ago
@sobolevn, you are impacted by this as well in wemake-python-styleguide
@AlexArcPy what happens if you remove coding
magic comment?
@sobolevn , same error!
I don't see Bandit in the traceback. Is this a problem just with flake8-bandit? Can you recreate the problem using just Bandit?
@ericwb , you are right, the issue is not with the bandit
, but rather with the flake8-bandit
. I'll post an issue in their repo, but they do not seem to be very active, so not sure if this is something anyone could look at.
Running
(BanditDebug) C:\Users\user>bandit "C:\Development\Flake8PluginDev\foo.py"
produces
[main] INFO profile include tests: None
[main] INFO profile exclude tests: None
[main] INFO cli include tests: None
[main] INFO cli exclude tests: None
[main] INFO running on Python 3.6.6
[95mRun started:2018-10-04 21:58:32.449122[0m
[95m
Test results:[0m
No issues identified.
[95m
Code scanned:[0m
Total lines of code: 2
Total lines skipped (#nosec): 0
[95m
Run metrics:[0m
Total issues (by severity):
Undefined: 0.0
Low: 0.0
Medium: 0.0
High: 0.0
Total issues (by confidence):
Undefined: 0.0
Low: 0.0
Medium: 0.0
High: 0.0
[95mFiles skipped (0):[0m
Description
I have:
I ran
pip install flake8-bandit
and got
Successfully installed GitPython-2.1.11 PyYAML-3.13 bandit-1.5.1 flake8-3.5.0 flake8-bandit-1.0.2 flake8-polyfill-1.0.2 gitdb2-2.0.4 mccabe-0.6.1 pbr-4.3.0 pycodestyle-2.3.1 pyflakes-1.6.0 six-1.11.0 smmap2-2.0.4 stevedore-1.29.0
I have a Python module with the following contents:
I run
flake8 C:\Development\Flake8PluginDev\foo.py
an error is produced.
To Reproduce
If I have
I run
flake8 C:\Development\Flake8PluginDev\foo.py
and get
C:\Development\Flake8PluginDev\foo.py:3:15: E261 at least two spaces before inline comment
It works fine.
Now if we change the Cyrillic
# й
comment into either the# э
,# я
, or# с
(with all three characters typed with Russian keyboard layout, mind Russian C) and runflake8 C:\Development\Flake8PluginDev\foo.py
an error is produced.
It seems as
bandit
has problems with only three Russian lettersэяс
because when running theflake8
with the comment containing all Russian letters exceptэяс
, it works fine:Expected behavior Bandit should handle all Cyrillic characters without throwing
UnicodeDecodeError
error.Bandit version