Remove pycodestyle version pin. Add E402 and W503 to ignore.

Rather than pinning pycodestyle, ignore the E402 and W503 error. Fix
issue with E731 (Do not assign a lambda expression, use a def).

W503 is something we will likely never enable as it is a personal
style decision and can change depending on the code. There is no one
right answer. Interestingly there is also a W504 which is the opposite
check.

E402 is one we should most likely fix. But it can be done in a follow
patch or patches.

List of various error codes:
https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes

Change-Id: Ie2c31a8a3c75beeef22453cab5878cf0094bdf3f
(cherry picked from commit ca91d4d871)
This commit is contained in:
John L. Villalovos 2018-04-10 16:48:00 -07:00 committed by Jim Rollenhagen
parent 41805c623f
commit 0fa32e8452
3 changed files with 5 additions and 3 deletions

View File

@ -261,7 +261,8 @@ class FsImageTestCase(base.TestCase):
def test__create_root_fs(self, path_exists_mock,
dirname_mock, mkdir_mock, cp_mock):
path_exists_mock_func = lambda path: path == 'root_dir'
def path_exists_mock_func(path):
return path == 'root_dir'
files_info = {
'a1': 'b1',

View File

@ -26,4 +26,3 @@ sphinxcontrib-seqdiag>=0.8.4 # BSD
openstackdocstheme>=1.18.1 # Apache-2.0
reno>=2.5.0 # Apache-2.0
os-api-ref>=1.4.0 # Apache-2.0
pycodestyle<=2.3.1

View File

@ -100,7 +100,9 @@ commands = {posargs}
[flake8]
# TODO(vdrok): Remove I202 from ignore list when we split out
# the tempest plugin
ignore = E129,I202
# [E402] Module level import not at top of file
# [W503] Line break before binary operator.
ignore = E129,I202,E402,W503
filename = *.py,app.wsgi
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build
import-order-style = pep8