Silence all uninteresting pylint recommendations
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Tue, 5 Nov 2013 08:40:19 +0000 (10:40 +0200)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Tue, 5 Nov 2013 08:40:19 +0000 (10:40 +0200)
Pylint produces many recommendations, but sometimes they are not very
interesting and I am not planning to change the code to fulfill them. For all
such cases, let's silence them. There are also a couple of false-positive
warnings like 'unable to import backports', silence them too.

Change-Id: Iac0a778877a6a71b9f28465d10c77b902a6b474e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
bmaptool
bmaptools/BmapCopy.py
bmaptools/TransRead.py
tests/test_api_base.py
tests/test_compat.py
tests/test_fiemap.py

index 3780a7404d28362bf45adaaaec8100596e480bcc..96d485a1d60b0eebf81b6903c736c2a7e8f79420 100755 (executable)
--- a/bmaptool
+++ b/bmaptool
@@ -44,7 +44,11 @@ also contribute to the mapped blocks and are also copied.
 
 # Disable the following pylint recommendations:
 #   * Too few public methods (R0903)
+#   * Too many statements (R0915)
+#   * Too many branches (R0912)
 # pylint: disable=R0903
+# pylint: disable=R0915
+# pylint: disable=R0912
 
 VERSION = "3.0"
 
index 5c9e5dcdf775a9e68c3eef528daf87b3dcb0b2a0..ebce45a86dfcb5a76ca89a458309068707c7c4f1 100644 (file)
@@ -45,7 +45,11 @@ also contribute to the mapped blocks and are also copied.
 
 # Disable the following pylint recommendations:
 #   * Too many instance attributes (R0902)
+#   * Too many arguments - R0913
+#   * Too many statements (R0915)
 # pylint: disable=R0902
+# pylint: disable=R0913
+# pylint: disable=R0915
 
 import os
 import stat
index ff7f74d03fbdd6f1f71d04acb9750bbb8a5bab60..b7c575d7af1c5a1627ec25607701f37c41f3a55f 100644 (file)
@@ -26,8 +26,12 @@ import logging
 #     false-positives for many of 'subprocess' class members, e.g.
 #     "Instance of 'Popen' has no 'wait' member".
 #   * Too many instance attributes (R0902)
+#   * Too many branches (R0912)
+#   * Too many local variables (R0914)
 # pylint: disable=E1101
 # pylint: disable=R0902
+# pylint: disable=R0912
+# pylint: disable=R0914
 
 # A list of supported compression types
 SUPPORTED_COMPRESSION_TYPES = ('bz2', 'gz', 'xz', 'tar.gz', 'tgz', 'tar.bz2',
@@ -314,7 +318,7 @@ class TransRead:
                     import lzma
                 except ImportError:
                     try:
-                        from backports import lzma
+                        from backports import lzma # pylint: disable=F0401
                     except ImportError:
                         raise Error("cannot import the \"lzma\" python module, "
                                     "it's required for decompressing .xz files")
index 1379e122e5be68a7726845e6aa2115df345cb5cd..ee6016427ee483700f200e7eaf5332ce9a644fef 100644 (file)
@@ -19,8 +19,12 @@ file and the copy and verifies that they are identical.
 """
 
 # Disable the following pylint recommendations:
-#   *  Too many public methods - R0904
+#   * Too many public methods (R0904)
+#   * Too many local variables (R0914)
+#   * Too many statements (R0915)
 # pylint: disable=R0904
+# pylint: disable=R0914
+# pylint: disable=R0915
 
 import os
 import tempfile
@@ -30,7 +34,7 @@ import random
 
 # This is a work-around for Centos 6
 try:
-    import unittest2 as unittest
+    import unittest2 as unittest # pylint: disable=F0401
 except ImportError:
     import unittest
 
@@ -78,7 +82,7 @@ def _generate_compressed_files(file_path, delete=True):
         import lzma
     except ImportError:
         try:
-            from backports import lzma
+            from backports import lzma # pylint: disable=F0401
         except ImportError:
             lzma_present = False
 
@@ -272,7 +276,7 @@ class TestCreateCopy(unittest.TestCase):
     function for different sparse files.
     """
 
-    def test(self):
+    def test(self): # pylint: disable=R0201
         """
         The test entry point. Executes the '_do_test()' function for files of
         different sizes, holes distribution and format.
index ea8e6061847453aa0e8d19c8216cabfed8e21600..3ceb2255a815003f003403de598bcc2eb1027151 100644 (file)
@@ -18,8 +18,11 @@ This unit test verifies various compatibility aspects of the BmapCopy module:
 """
 
 # Disable the following pylint recommendations:
-#   *  Too many public methods - R0904
+#   *  Too many public methods (R0904)
+#   *  Attribute 'XYZ' defined outside __init__ (W0201), because unittest
+#      classes are not supposed to have '__init__()'
 # pylint: disable=R0904
+# pylint: disable=W0201
 
 import os
 import shutil
@@ -38,7 +41,7 @@ _OLDCODEBASE_SUBDIR = "oldcodebase"
 
 # This is a work-around for Centos 6
 try:
-    import unittest2 as unittest
+    import unittest2 as unittest # pylint: disable=F0401
 except ImportError:
     import unittest
 
@@ -135,7 +138,7 @@ class TestCreateCopy(unittest.TestCase):
             if supported_ver >= bmap_version:
                 writer = old_bmapcopy_class(self._f_image, self._f_copy, f_bmap)
                 writer.copy(True, True)
-        except:
+        except: # pylint: disable=W0702
             if supported_ver >= bmap_version_major:
                 # The BmapCopy which we are testing is supposed to support this
                 # version of bmap file format. However, bmap format version 1.4
index d9ab85ce8005f883c03f69898a0d58bc03516346..621aa7282f9ca2d384d6e148dccd5b9bcf04924c 100644 (file)
@@ -28,7 +28,7 @@ import itertools
 
 # This is a work-around for Centos 6
 try:
-    import unittest2 as unittest
+    import unittest2 as unittest # pylint: disable=F0401
 except ImportError:
     import unittest
 
@@ -123,7 +123,7 @@ class TestCreateCopy(unittest.TestCase):
     function for different sparse files.
     """
 
-    def test(self):
+    def test(self): # pylint: disable=R0201
         """
         The test entry point. Executes the '_do_test()' function for files of
         different sizes, holes distribution and format.