From 30e15ec4ae9fe0ff129d89d3e48ef56987c6c775 Mon Sep 17 00:00:00 2001 From: Zhiteng Huang Date: Wed, 30 Jul 2014 14:06:37 +0800 Subject: [PATCH] Enable H104, F841 hacking rule and fix violations MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 | 13 ------------- cinder/tests/test_glusterfs.py | 2 +- cinder/tests/test_ibm_xiv_ds8k.py | 4 +--- cinder/tests/test_migrations.py | 4 ++-- cinder/volume/drivers/hds/hnas_backend.py | 6 +++--- cinder/volume/drivers/hds/nfs.py | 4 ++-- tox.ini | 2 +- 7 files changed, 10 insertions(+), 25 deletions(-) diff --git a/cinder/openstack/__init__.py b/cinder/openstack/__init__.py index 00a266a59..e69de29bb 100644 --- a/cinder/openstack/__init__.py +++ b/cinder/openstack/__init__.py @@ -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. diff --git a/cinder/tests/test_glusterfs.py b/cinder/tests/test_glusterfs.py index c81e48f8f..608493882 100644 --- a/cinder/tests/test_glusterfs.py +++ b/cinder/tests/test_glusterfs.py @@ -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) diff --git a/cinder/tests/test_ibm_xiv_ds8k.py b/cinder/tests/test_ibm_xiv_ds8k.py index 3d0995b62..64bb53d56 100644 --- a/cinder/tests/test_ibm_xiv_ds8k.py +++ b/cinder/tests/test_ibm_xiv_ds8k.py @@ -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 diff --git a/cinder/tests/test_migrations.py b/cinder/tests/test_migrations.py index 31ade1b82..e3d3716ca 100644 --- a/cinder/tests/test_migrations.py +++ b/cinder/tests/test_migrations.py @@ -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() diff --git a/cinder/volume/drivers/hds/hnas_backend.py b/cinder/volume/drivers/hds/hnas_backend.py index 802b3b873..58075d72a 100644 --- a/cinder/volume/drivers/hds/hnas_backend.py +++ b/cinder/volume/drivers/hds/hnas_backend.py @@ -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 diff --git a/cinder/volume/drivers/hds/nfs.py b/cinder/volume/drivers/hds/nfs.py index c93ddfdcd..079db730a 100644 --- a/cinder/volume/drivers/hds/nfs.py +++ b/cinder/volume/drivers/hds/nfs.py @@ -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 bcb90eae4..15ce7d545 100644 --- 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 -- 2.45.2