]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Enable H104, F841 hacking rule and fix violations
authorZhiteng Huang <zhithuang@ebaysf.com>
Wed, 30 Jul 2014 06:06:37 +0000 (14:06 +0800)
committerZhiteng Huang <zhithuang@ebaysf.com>
Mon, 11 Aug 2014 04:21:36 +0000 (12:21 +0800)
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

cinder/openstack/__init__.py
cinder/tests/test_glusterfs.py
cinder/tests/test_ibm_xiv_ds8k.py
cinder/tests/test_migrations.py
cinder/volume/drivers/hds/hnas_backend.py
cinder/volume/drivers/hds/nfs.py
tox.ini

index 00a266a597794ca596c72c2b7f5d2401eca77763..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -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.
index c81e48f8ffa48ba37ede99ec9d7352ad52ac0bd1..608493882f192d36fe45d6113983f66319d25d3f 100644 (file)
@@ -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)
index 3d0995b62829f48ce31a640d47d8a201939f426d..64bb53d562aa3689e8349ae55839fa359c6f18a7 100644 (file)
@@ -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
index 31ade1b823d5d6837d8940796dd258bb79118a48..e3d3716ca1d930fc5a07969241e9f290592c32ad 100644 (file)
@@ -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()
index 802b3b8737e5654399d8d86881006aa6ed071183..58075d72a66ba357cf7bcf5098bb111094dce54a 100644 (file)
@@ -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
index c93ddfdcdcaa00c62d9777896878f7e183204583..079db730acfcfc8f2c8779cf7cf03584b0825c30 100644 (file)
@@ -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] = {}
diff --git a/tox.ini b/tox.ini
index bcb90eae4e72c9050cff3c9cd175eda31b97441b..15ce7d545faafd6e593915f7bebdd5f2c9e2e42d 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -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