Gate on H4xx docstrings for pep8
In an effort to help horizon more friendly to OpenStack hacking guidelines, we now gate on H40* violations. Change-Id: Id07294543660368d2f7f5ac363710176ab23b874 Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
This commit is contained in:
parent
7a03160eb6
commit
4e50f5ebb4
|
@ -29,9 +29,7 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
|
||||
def exception_to_validation_msg(e):
|
||||
'''
|
||||
Extracts a validation message to display to the user.
|
||||
'''
|
||||
"""Extracts a validation message to display to the user."""
|
||||
try:
|
||||
error = json.loads(str(e))
|
||||
# NOTE(jianingy): if no message exists, we just return 'None'
|
||||
|
|
|
@ -140,9 +140,7 @@ def get_resource_status(status):
|
|||
|
||||
|
||||
def get_resource_image(status, type):
|
||||
'''
|
||||
Sets the image url and in_progress action sw based on status.
|
||||
'''
|
||||
"""Sets the image url and in_progress action sw based on status."""
|
||||
resource_type = get_resource_type(type)
|
||||
resource_status = get_resource_status(status)
|
||||
resource_state = resource_type + "_" + resource_status
|
||||
|
|
|
@ -108,8 +108,7 @@ class RequestFactoryWithMessages(RequestFactory):
|
|||
@unittest.skipIf(os.environ.get('SKIP_UNITTESTS', False),
|
||||
"The SKIP_UNITTESTS env variable is set.")
|
||||
class TestCase(horizon_helpers.TestCase):
|
||||
"""
|
||||
Specialized base test case class for Horizon which gives access to
|
||||
"""Specialized base test case class for Horizon which gives access to
|
||||
numerous additional features:
|
||||
|
||||
* A full suite of test data through various attached objects and
|
||||
|
@ -180,8 +179,7 @@ class TestCase(horizon_helpers.TestCase):
|
|||
utils.get_user = get_user
|
||||
|
||||
def assertRedirectsNoFollow(self, response, expected_url):
|
||||
"""
|
||||
Asserts that the given response issued a 302 redirect without
|
||||
"""Asserts that the given response issued a 302 redirect without
|
||||
processing the view which is redirected to.
|
||||
"""
|
||||
assert (response.status_code / 100 == 3), \
|
||||
|
@ -191,8 +189,7 @@ class TestCase(horizon_helpers.TestCase):
|
|||
self.assertEqual(response.status_code, 302)
|
||||
|
||||
def assertNoFormErrors(self, response, context_name="form"):
|
||||
"""
|
||||
Asserts that the response either does not contain a form in its
|
||||
"""Asserts that the response either does not contain a form in its
|
||||
context, or that if it does, that form has no errors.
|
||||
"""
|
||||
context = getattr(response, "context", {})
|
||||
|
@ -204,8 +201,7 @@ class TestCase(horizon_helpers.TestCase):
|
|||
|
||||
def assertFormErrors(self, response, count=0, message=None,
|
||||
context_name="form"):
|
||||
"""
|
||||
Asserts that the response does contain a form in its
|
||||
"""Asserts that the response does contain a form in its
|
||||
context, and that form has errors, if count were given,
|
||||
it must match the exact numbers of errors
|
||||
"""
|
||||
|
@ -226,8 +222,7 @@ class TestCase(horizon_helpers.TestCase):
|
|||
|
||||
|
||||
class BaseAdminViewTests(TestCase):
|
||||
"""
|
||||
A ``TestCase`` subclass which sets an active user with the "admin" role
|
||||
"""A ``TestCase`` subclass which sets an active user with the "admin" role
|
||||
for testing admin-only views and functionality.
|
||||
"""
|
||||
def setActiveUser(self, *args, **kwargs):
|
||||
|
@ -248,8 +243,7 @@ class BaseAdminViewTests(TestCase):
|
|||
|
||||
|
||||
class APITestCase(TestCase):
|
||||
"""
|
||||
The ``APITestCase`` class is for use with tests which deal with the
|
||||
"""The ``APITestCase`` class is for use with tests which deal with the
|
||||
underlying clients rather than stubbing out the
|
||||
openstack_dashboard.api.* methods.
|
||||
"""
|
||||
|
@ -258,8 +252,7 @@ class APITestCase(TestCase):
|
|||
utils.patch_middleware_get_user()
|
||||
|
||||
def fake_keystoneclient(request, admin=False):
|
||||
"""
|
||||
Wrapper function which returns the stub keystoneclient. Only
|
||||
"""Wrapper function which returns the stub keystoneclient. Only
|
||||
necessary because the function takes too many arguments to
|
||||
conveniently be a lambda.
|
||||
"""
|
||||
|
@ -414,8 +407,7 @@ class SeleniumTestCase(horizon_helpers.SeleniumTestCase):
|
|||
|
||||
|
||||
class SeleniumAdminTestCase(SeleniumTestCase):
|
||||
"""
|
||||
A ``TestCase`` subclass which sets an active user with the "admin" role
|
||||
"""A ``TestCase`` subclass which sets an active user with the "admin" role
|
||||
for testing admin-only views and functionality.
|
||||
"""
|
||||
def setActiveUser(self, *args, **kwargs):
|
||||
|
|
3
tox.ini
3
tox.ini
|
@ -34,8 +34,7 @@ builtins = _
|
|||
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py
|
||||
# E127 continuation line over-indented for visual indent
|
||||
# E128 continuation line under-indented for visual indent
|
||||
# H4xx docstrings
|
||||
# H701 empty localization string
|
||||
# H702 Formatting operation should be outside of localization method call
|
||||
# H803 git commit title should not end with period (disabled on purpose, see bug #1236621)
|
||||
ignore = E127,E128,H4,H701,H702,H803
|
||||
ignore = E127,E128,H701,H702,H803
|
||||
|
|
Loading…
Reference in New Issue