Remove [H405] and [H404] ignoring in tox.ini

Remove H405 and H404 rule from ignored rules in
tox.ini.

Also, fix some new [H405]/[H404] errors.

Change-Id: I71065e2c3c300aa69ce204ee78672b08ca413651
This commit is contained in:
Peter Razumovsky 2015-09-24 18:36:38 +03:00
parent c4b0ced813
commit 1a972838ba
5 changed files with 10 additions and 21 deletions

View File

@ -28,8 +28,7 @@ from heat.common.i18n import _
class ExceptionFilter(object): class ExceptionFilter(object):
""" """A context manager that prevents some exceptions from being raised.
A context manager that prevents some exceptions from being raised.
For backwards compatibility, these objects can also be called with the For backwards compatibility, these objects can also be called with the
exception value as an argument - any non-matching exception will be exception value as an argument - any non-matching exception will be
@ -55,7 +54,6 @@ class ExceptionFilter(object):
... assert False ... assert False
... except Exception as ex: ... except Exception as ex:
... ignore_assertions(ex) ... ignore_assertions(ex)
""" """
def __init__(self, should_ignore_ex): def __init__(self, should_ignore_ex):
@ -73,8 +71,7 @@ class ExceptionFilter(object):
return self._should_ignore_ex(exc_val) return self._should_ignore_ex(exc_val)
def __call__(self, ex): def __call__(self, ex):
""" """Re-raise any exception value not being filtered out.
Re-raise any exception value not being filtered out.
If the exception was the last to be raised, it will be re-raised with If the exception was the last to be raised, it will be re-raised with
its original traceback. its original traceback.

View File

@ -260,13 +260,12 @@ class Replace(cfn_funcs.Replace):
class ReplaceJson(Replace): class ReplaceJson(Replace):
''' """A function for performing string substitutions.
A function for performing string substitutions.
Behaves the same as Replace, but tolerates non-string parameter Behaves the same as Replace, but tolerates non-string parameter
values, e.g map/list - these are serialized as json before doing values, e.g map/list - these are serialized as json before doing
the string substitution. the string substitution.
''' """
def result(self): def result(self):
template = function.resolve(self._string) template = function.resolve(self._string)

View File

@ -120,7 +120,7 @@ class Resource(object):
signal_needs_metadata_updates = True signal_needs_metadata_updates = True
def __new__(cls, name, definition, stack): def __new__(cls, name, definition, stack):
'''Create a new Resource of the appropriate class for its type.''' """Create a new Resource of the appropriate class for its type."""
assert isinstance(definition, rsrc_defn.ResourceDefinition) assert isinstance(definition, rsrc_defn.ResourceDefinition)
@ -1092,24 +1092,22 @@ class Resource(object):
return name[0:2] + '-' + name[-postfix_length:] return name[0:2] + '-' + name[-postfix_length:]
def validate(self): def validate(self):
''' """Validate the resource.
Validate the resource.
This may be overridden by resource plugins to add extra This may be overridden by resource plugins to add extra
validation logic specific to the resource implementation. validation logic specific to the resource implementation.
''' """
LOG.info(_LI('Validating %s'), six.text_type(self)) LOG.info(_LI('Validating %s'), six.text_type(self))
return self.validate_template() return self.validate_template()
def validate_template(self): def validate_template(self):
''' """Validate structural/syntax aspects of the resource definition.
Validate strucural/syntax aspects of the resource definition.
Resource plugins should not override this, because this interface Resource plugins should not override this, because this interface
is expected to be called pre-create so things normally valid is expected to be called pre-create so things normally valid
in an overridden validate() such as accessing properties in an overridden validate() such as accessing properties
may not work. may not work.
''' """
function.validate(self.t) function.validate(self.t)
self.validate_deletion_policy(self.t.deletion_policy()) self.validate_deletion_policy(self.t.deletion_policy())
self.t.update_policy(self.update_policy_schema, self.t.update_policy(self.update_policy_schema,

View File

@ -958,9 +958,7 @@ class EngineService(service.Service):
@context.request_context @context.request_context
def validate_template(self, cnxt, template, params=None, files=None, def validate_template(self, cnxt, template, params=None, files=None,
show_nested=False): show_nested=False):
""" """Uses the stack parser to check the validity of a template.
The validate_template method uses the stack parser to check
the validity of a template.
:param cnxt: RPC context. :param cnxt: RPC context.
:param template: Template of stack you want to create. :param template: Template of stack you want to create.

View File

@ -61,9 +61,6 @@ deps = -r{toxinidir}/test-requirements.txt
commands = bandit -c bandit.yaml -r heat -n5 -p heat_conservative commands = bandit -c bandit.yaml -r heat -n5 -p heat_conservative
[flake8] [flake8]
# H404 multi line docstring should start with a summary
# H405 multi line docstring summary not separated with an empty line
ignore = H404,H405
show-source = true show-source = true
exclude=.*,dist,*openstack/common*,*lib/python*,*egg,tools,build,*convergence/scenarios/* exclude=.*,dist,*openstack/common*,*lib/python*,*egg,tools,build,*convergence/scenarios/*
max-complexity=20 max-complexity=20