Activate H404 checks

Change-Id: If23d9a90ee3326528ff67cfdb77b33501cbfb690
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2013-06-13 15:14:54 +02:00
parent bc463a560a
commit 782a71c012
11 changed files with 32 additions and 53 deletions

View File

@ -129,8 +129,7 @@ class Query(_Base):
def _sanitize_query(q):
'''
Check the query to see if:
'''Check the query to see if:
1) the request is comming from admin - then allow full visibility
2) non-admin - make sure that the query includes the requester's
project.

View File

@ -113,14 +113,11 @@ class InstanceNotFoundException(InspectorException):
class Inspector(object):
def inspect_instances(self):
"""
List the instances on the current host.
"""
"""List the instances on the current host. """
raise NotImplementedError()
def inspect_cpus(self, instance_name):
"""
Inspect the CPU statistics for an instance.
"""Inspect the CPU statistics for an instance.
:param instance_name: the name of the target instance
:return: the number of CPUs and cumulative CPU time
@ -128,8 +125,7 @@ class Inspector(object):
raise NotImplementedError()
def inspect_vnics(self, instance_name):
"""
Inspect the vNIC statistics for an instance.
"""Inspect the vNIC statistics for an instance.
:param instance_name: the name of the target instance
:return: for each vNIC, the number of bytes & packets
@ -138,8 +134,7 @@ class Inspector(object):
raise NotImplementedError()
def inspect_disks(self, instance_name):
"""
Inspect the disk statistics for an instance.
"""Inspect the disk statistics for an instance.
:param instance_name: the name of the target instance
:return: for each disk, the number of bytes & operations

View File

@ -35,10 +35,7 @@ cfg.CONF.register_opts(OPTS)
class ImageBase(plugin.NotificationBase):
"""
Listen for image.send notifications in order to mediate with
the metering framework.
"""
"""Base class for image counting. """
@staticmethod
def get_exchange_topics(conf):

View File

@ -66,9 +66,7 @@ from ceilometer import transformer
class CeilometerMiddleware(object):
"""
Ceilometer middleware used for counting requests.
"""
"""Ceilometer middleware used for counting requests."""
def __init__(self, app, conf):
self.app = app

View File

@ -88,9 +88,7 @@ class Connection(base.Connection):
"""
def __init__(self, conf):
'''
Hbase Connection Initialization
'''
"""Hbase Connection Initialization"""
opts = self._parse_connection_url(conf.database.connection)
opts['table_prefix'] = conf.table_prefix

View File

@ -49,7 +49,8 @@ class Event(Model):
Metrics will be derived from one or more Events.
"""
def __init__(self, event_name, generated, traits):
"""
"""Create a new event.
:param event_name: Name of the event.
:param generated: UTC time for when the event occured.
:param traits: list of Traits on this Event.
@ -89,7 +90,8 @@ class Resource(Model):
def __init__(self, resource_id, project_id, source, user_id, metadata,
meter):
"""
"""Create a new resource.
:param resource_id: UUID of the resource
:param project_id: UUID of project owning the resource
:param source: the identifier for the user/project id definition
@ -115,7 +117,8 @@ class ResourceMeter(Model):
"""
def __init__(self, counter_name, counter_type, counter_unit):
"""
"""Create a new resource meter.
:param counter_name: the name of the counter updating the resource
:param counter_type: one of gauge, delta, cumulative
:param counter_unit: official units name for the sample data
@ -133,7 +136,8 @@ class Meter(Model):
def __init__(self, name, type, unit, resource_id, project_id, source,
user_id):
"""
"""Create a new meter.
:param name: name of the meter
:param type: type of the meter (guage, counter)
:param unit: unit of the meter
@ -164,7 +168,8 @@ class Sample(Model):
message_id,
message_signature,
):
"""
"""Create a new sample.
:param source: the identifier for the user/project id definition
:param counter_name: the name of the measurement being taken
:param counter_type: the type of the measurement
@ -201,7 +206,8 @@ class Statistics(Model):
min, max, avg, sum, count,
period, period_start, period_end,
duration, duration_start, duration_end):
"""
"""Create a new statistics object.
:param min: The smallest volume found
:param max: The largest volume found
:param avg: The average of all volumes found

View File

@ -72,8 +72,7 @@ class TestBase(db_test_base.TestBase):
class FunctionalTest(db_test_base.TestBase):
"""
Used for functional tests of Pecan controllers where you need to
"""Used for functional tests of Pecan controllers where you need to
test your literal application and its integration with the
framework.
"""

View File

@ -133,10 +133,8 @@ class TestAlarms(FunctionalTest):
self.assertEquals(alarm.name, json['name'])
def test_put_alarm_wrong_field(self):
'''
Note: wsme will ignore unknown fields so will
just not appear in the Alarm.
'''
# Note: wsme will ignore unknown fields so will just not appear in
# the Alarm.
json = {
'name': 'renamed_alarm',
'this_can_not_be_correct': 'ha',

View File

@ -61,9 +61,7 @@ class TestPostSamples(FunctionalTest):
self.assertEquals(s1, data.json)
def test_wrong_project_id(self):
'''
do not accept cross posting samples to different projects
'''
"""Do not accept cross posting samples to different projects."""
s1 = [{'counter_name': 'my_counter_name',
'counter_type': 'gauge',
'counter_unit': 'instance',
@ -87,11 +85,10 @@ class TestPostSamples(FunctionalTest):
self.assertEquals(data.status_int, 400)
def test_multiple_samples(self):
'''
send multiple samples.
"""Send multiple samples.
The usecase here is to reduce the chatter and send the counters
at a slower cadence.
'''
"""
samples = []
stamps = []
for x in range(6):
@ -127,9 +124,7 @@ class TestPostSamples(FunctionalTest):
self.assertEquals(v, data.json[x][k])
def test_missing_mandatory_fields(self):
'''
do not accept posting samples with missing mandatory fields
'''
"""Do not accept posting samples with missing mandatory fields."""
s1 = [{'counter_name': 'my_counter_name',
'counter_type': 'gauge',
'counter_unit': 'instance',
@ -152,9 +147,7 @@ class TestPostSamples(FunctionalTest):
self.assertEquals(data.status_int, 400)
def test_multiple_sources(self):
'''
do not accept a single post of mixed sources
'''
"""Do not accept a single post of mixed sources."""
s1 = [{'counter_name': 'my_counter_name',
'counter_type': 'gauge',
'counter_unit': 'instance',
@ -179,11 +172,9 @@ class TestPostSamples(FunctionalTest):
self.assertEquals(data.status_int, 400)
def test_multiple_samples_some_null_sources(self):
'''
do accept a single post with some null sources
"""Do accept a single post with some null sources
this is a convience feature so you only have to set
one of the sample's source field.
'''
one of the sample's source field."""
s1 = [{'counter_name': 'my_counter_name',
'counter_type': 'gauge',
'counter_unit': 'instance',

View File

@ -156,9 +156,7 @@ class TestSwiftMiddleware(base.TestCase):
self.assertEqual(data.volume, 1)
def test_bogus_request(self):
"""
test even for arbitrary request method, this will still work
"""
"""Test even for arbitrary request method, this will still work."""
app = swift_middleware.CeilometerMiddleware(FakeApp(body=['']), {})
req = Request.blank('/1.0/account/container/obj',
environ={'REQUEST_METHOD': 'BOGUS'})

View File

@ -40,7 +40,7 @@ deps = -r{toxinidir}/requirements.txt
commands = {posargs}
[flake8]
ignore = E125,F403,H301,H302,H304,H306,H401,H402,H403,H404
ignore = E125,F403,H301,H302,H304,H306,H401,H402,H403
builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools,nova_tests
show-source = True