Allow Hacking H401, H403 check

Currently swift ignores a lot of the Hacking style guide. This patch
enables the H401 and H403 checks and fixes any violations. With this
we can get a little closer to following the OpenStack style guidelines.

Change-Id: I5109a052f2ceb2e6a9a174cded62f4231156d39b
This commit is contained in:
kellerbr 2017-01-04 16:21:06 +00:00
parent cbb99f97b0
commit aa17ae1b04
4 changed files with 9 additions and 8 deletions

View File

@ -385,9 +385,11 @@ check_container_format = functools.partial(check_name_format,
def valid_api_version(version):
""" Checks if the requested version is valid.
"""
Checks if the requested version is valid.
Currently Swift only supports "v1" and "v1.0". """
Currently Swift only supports "v1" and "v1.0".
"""
global VALID_API_VERSIONS
if not isinstance(VALID_API_VERSIONS, list):
VALID_API_VERSIONS = [str(VALID_API_VERSIONS)]

View File

@ -1693,13 +1693,13 @@ class RingBuilder(object):
return matched_devs
def increase_partition_power(self):
""" Increases ring partition power by one.
"""
Increases ring partition power by one.
Devices will be assigned to partitions like this:
OLD: 0, 3, 7, 5, 2, 1, ...
NEW: 0, 0, 3, 3, 7, 7, 5, 5, 2, 2, 1, 1, ...
"""
new_replica2part2dev = []

View File

@ -132,7 +132,8 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
self.fail(msg)
def create_sample_ring(self, part_power=6):
""" Create a sample ring with four devices
"""
Create a sample ring with four devices
At least four devices are needed to test removing
a device, since having less devices than replicas

View File

@ -100,12 +100,10 @@ commands = bandit -c bandit.yaml -r swift -n 5
# H202: assertRaises Exception too broad
# H301: one import per line
# H306: imports not in alphabetical order (time, os)
# H401: docstring should not start with a space
# H403: multi line docstrings should end on a new line
# H404: multi line docstring should start without a leading new line
# H405: multi line docstring summary not separated with an empty line
# H501: Do not use self.__dict__ for string formatting
ignore = H101,H202,H301,H306,H401,H403,H404,H405,H501
ignore = H101,H202,H301,H306,H404,H405,H501
exclude = .venv,.tox,dist,*egg
filename = *.py,bin/*
show-source = True