Enable H104, F841 hacking rule and fix violations

This change enables hacking check H104 and F841, and fixes all
violations.

[H104]    Files with no code shouldn’t contain any license header nor
          comments, and must be left completely empty.
[F841]    local variable name is assigned to but never used

Change-Id: If7fcb737d121fd13b2b103d63f5f26dfaa79c59b
This commit is contained in:
Zhiteng Huang 2014-07-30 14:06:37 +08:00
parent 79b6b98f21
commit 30e15ec4ae
7 changed files with 10 additions and 25 deletions

@ -1,13 +0,0 @@
# Copyright (c) 2011 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

@ -2061,7 +2061,7 @@ class GlusterFsDriverTestCase(test.TestCase):
self.TEST_MNT_POINT_BASE)
def test_get_mount_point_base(self):
(mox, drv) = self._mox, self._driver
drv = self._driver
self.assertEqual(drv._get_mount_point_base(),
self.TEST_MNT_POINT_BASE)

@ -300,9 +300,7 @@ class XIVDS8KVolumeDriverTest(test.TestCase):
self.driver.do_setup(None)
self.driver.create_volume(MANAGED_VOLUME)
existing_ref = {'source-name': MANAGED_VOLUME['name']}
has_volume = self.driver.manage_existing(
VOLUME,
existing_ref)
self.driver.manage_existing(VOLUME, existing_ref)
self.assertEqual(VOLUME['size'], MANAGED_VOLUME['size'])
# cover both case, whether driver renames the volume or not

@ -165,7 +165,7 @@ class TestMigrations(test.TestCase):
def execute_cmd(cmd=None):
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, shell=True)
output = proc.communicate()[0]
proc.communicate()[0]
self.assertEqual(0, proc.returncode)
for key, engine in self.engines.items():
@ -1075,7 +1075,7 @@ class TestMigrations(test.TestCase):
reservations = sqlalchemy.Table('reservations',
metadata,
autoload=True)
index_colums = []
index_columns = []
for idx in reservations.indexes:
if idx.name == 'reservations_deleted_expire_idx':
index_columns = idx.columns.keys()

@ -84,7 +84,7 @@ class HnasBackend():
for line in lines:
if 'evs' in line and 'admin' not in line:
inf = line.split()
(evsnum, evsname, ip) = (inf[1], inf[2], inf[3])
(evsnum, ip) = (inf[1], inf[3])
newout += "CTL: %s Port: 0 IP: %s Port: 3260 Link: Up\n" \
% (evsnum, ip)
@ -112,8 +112,8 @@ class HnasBackend():
continue
if 'GB' in line or 'TB' in line:
inf = line.split()
(fsid, fslabel, evsnum, capacity, used, perstr) = \
(inf[0], inf[1], inf[2], inf[3], inf[5], inf[7])
(fsid, fslabel, capacity, used, perstr) = \
(inf[0], inf[1], inf[3], inf[5], inf[7])
(availunit, usedunit) = (inf[4], inf[6])
if usedunit == 'GB':
usedmultiplier = units.Ki

@ -413,8 +413,8 @@ class HDSNFSDriver(nfs.NfsDriver):
for line in lines:
if 'Export' in line:
inf = line.split()
(export, path, fslabel, hdp, evs, ip1) = \
inf[1], inf[3], inf[5], inf[7], inf[9], inf[11]
(export, path, fslabel, hdp, ip1) = \
inf[1], inf[3], inf[5], inf[7], inf[11]
# 9, 10, etc are IP addrs
key = ip1 + ':' + export
conf[key] = {}

@ -72,7 +72,7 @@ commands = {posargs}
# F841,H302,H305,H307,H405
ignore = E251,E265,F402,F841,H104,H302,H305,H307,H402,H405,H803,H904
ignore = E251,E265,F402,H302,H305,H307,H402,H405,H803,H904
builtins = _
exclude = .git,.venv,.tox,dist,tools,doc,common,*egg,build