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:
Paul Belanger 2013-11-01 14:02:41 -04:00
parent 7a03160eb6
commit 4e50f5ebb4
4 changed files with 11 additions and 24 deletions

View File

@ -29,9 +29,7 @@ LOG = logging.getLogger(__name__)
def exception_to_validation_msg(e): 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: try:
error = json.loads(str(e)) error = json.loads(str(e))
# NOTE(jianingy): if no message exists, we just return 'None' # NOTE(jianingy): if no message exists, we just return 'None'

View File

@ -140,9 +140,7 @@ def get_resource_status(status):
def get_resource_image(status, type): 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_type = get_resource_type(type)
resource_status = get_resource_status(status) resource_status = get_resource_status(status)
resource_state = resource_type + "_" + resource_status resource_state = resource_type + "_" + resource_status

View File

@ -108,8 +108,7 @@ class RequestFactoryWithMessages(RequestFactory):
@unittest.skipIf(os.environ.get('SKIP_UNITTESTS', False), @unittest.skipIf(os.environ.get('SKIP_UNITTESTS', False),
"The SKIP_UNITTESTS env variable is set.") "The SKIP_UNITTESTS env variable is set.")
class TestCase(horizon_helpers.TestCase): 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: numerous additional features:
* A full suite of test data through various attached objects and * 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 utils.get_user = get_user
def assertRedirectsNoFollow(self, response, expected_url): 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. processing the view which is redirected to.
""" """
assert (response.status_code / 100 == 3), \ assert (response.status_code / 100 == 3), \
@ -191,8 +189,7 @@ class TestCase(horizon_helpers.TestCase):
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
def assertNoFormErrors(self, response, context_name="form"): 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, or that if it does, that form has no errors.
""" """
context = getattr(response, "context", {}) context = getattr(response, "context", {})
@ -204,8 +201,7 @@ class TestCase(horizon_helpers.TestCase):
def assertFormErrors(self, response, count=0, message=None, def assertFormErrors(self, response, count=0, message=None,
context_name="form"): 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, context, and that form has errors, if count were given,
it must match the exact numbers of errors it must match the exact numbers of errors
""" """
@ -226,8 +222,7 @@ class TestCase(horizon_helpers.TestCase):
class BaseAdminViewTests(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. for testing admin-only views and functionality.
""" """
def setActiveUser(self, *args, **kwargs): def setActiveUser(self, *args, **kwargs):
@ -248,8 +243,7 @@ class BaseAdminViewTests(TestCase):
class APITestCase(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 underlying clients rather than stubbing out the
openstack_dashboard.api.* methods. openstack_dashboard.api.* methods.
""" """
@ -258,8 +252,7 @@ class APITestCase(TestCase):
utils.patch_middleware_get_user() utils.patch_middleware_get_user()
def fake_keystoneclient(request, admin=False): 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 necessary because the function takes too many arguments to
conveniently be a lambda. conveniently be a lambda.
""" """
@ -414,8 +407,7 @@ class SeleniumTestCase(horizon_helpers.SeleniumTestCase):
class SeleniumAdminTestCase(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. for testing admin-only views and functionality.
""" """
def setActiveUser(self, *args, **kwargs): def setActiveUser(self, *args, **kwargs):

View File

@ -34,8 +34,7 @@ builtins = _
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py 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 # E127 continuation line over-indented for visual indent
# E128 continuation line under-indented for visual indent # E128 continuation line under-indented for visual indent
# H4xx docstrings
# H701 empty localization string # H701 empty localization string
# H702 Formatting operation should be outside of localization method call # 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) # 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