Bump flake8 to 5.0 to pick up fixes
There is a bug [1] in older flake8 that we need to pick up. In
particular, Nova has at least one line longer than 80 characters in it
[2] because of that bug. Our own unit tests start breaking with the
new flake8, so we need to fix whitespace for one `if`, and start
calling flake8 with `--enable-extentions` to force flake8 to load
extensions decorated with @off_by_default.
[1] https://github.com/PyCQA/flake8/issues/1534
[2] 5c32d5efe1/nova/image/glance.py (L392)
Change-Id: I7799049924b5a2cde867c88c03154c36831c9670
This commit is contained in:
parent
52b9f4f110
commit
3fde1e570a
@ -158,8 +158,11 @@ def hacking_python3x_metaclass(logical_line, noqa):
|
||||
if noqa:
|
||||
return
|
||||
split_line = logical_line.split()
|
||||
if(len(split_line) > 2 and split_line[0] == '__metaclass__' and
|
||||
split_line[1] == '='):
|
||||
if (
|
||||
len(split_line) > 2
|
||||
and split_line[0] == '__metaclass__'
|
||||
and split_line[1] == '='
|
||||
):
|
||||
yield (logical_line.find('__metaclass__'),
|
||||
"H236: Python 3.x incompatible __metaclass__, "
|
||||
"use six.add_metaclass()")
|
||||
|
@ -40,7 +40,8 @@ class HackingTestCase(hacking.tests.TestCase):
|
||||
f.write(''.join(self.lines))
|
||||
|
||||
cmd = [sys.executable, '-mflake8', '--isolated',
|
||||
'--select=%s' % self.code, '--ignore=F',
|
||||
'--select=%s' % self.code,
|
||||
'--enable-extensions=%s' % self.code, '--ignore=F',
|
||||
'--format=%(code)s\t%(path)s\t%(row)d', f.name]
|
||||
out, _ = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()
|
||||
|
||||
@ -52,6 +53,7 @@ class HackingTestCase(hacking.tests.TestCase):
|
||||
self.addDetail('reason',
|
||||
content.text_content("Failed to trigger rule %s" %
|
||||
self.code))
|
||||
|
||||
self.assertNotEqual('', out)
|
||||
self.assertEqual(self.code, out.split('\t')[0].rstrip(':'), out)
|
||||
|
||||
|
@ -1 +1 @@
|
||||
flake8~=4.0.1 # MIT
|
||||
flake8~=5.0.1 # MIT
|
||||
|
Loading…
Reference in New Issue
Block a user