]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Disable too-many/too-few pylint checks
authorNicki Křížek <nicki@isc.org>
Mon, 14 Oct 2024 12:44:06 +0000 (14:44 +0200)
committerNicki Křížek <nicki@isc.org>
Thu, 17 Oct 2024 09:01:44 +0000 (11:01 +0200)
Enforcing pylint standards and default for our test code seems
counter-productive. Since most of the newly added code are tests or is
test-related, encountering these checks rarely make us refactor the code
in other ways and we just disable these checks individually. Code that
is too complex or convoluted will be pointed out in reviews anyways.

14 files changed:
.pylintrc
bin/tests/system/conftest.py
bin/tests/system/isctest/asyncserver.py
bin/tests/system/isctest/instance.py
bin/tests/system/isctest/kasp.py
bin/tests/system/isctest/query.py
bin/tests/system/isctest/rndc.py
bin/tests/system/isctest/run.py
bin/tests/system/ksr/tests_ksr.py
bin/tests/system/shutdown/tests_shutdown.py
bin/tests/system/tsiggss/tests_isc_spnego_flaws.py
doc/arm/_ext/iscconf.py
doc/arm/conf.py
util/parse_tsan.py

index a75e65d8d3a8608aed58715f0711a8b24460d950..3fb33f3c9cc7c98daf6de6a611f01594b1baef30 100644 (file)
--- a/.pylintrc
+++ b/.pylintrc
@@ -12,6 +12,17 @@ disable=
     C0116, # missing-function-docstring
     C0209, # consider-using-f-string
     C0301, # line-too-long, handled better by black
+    C0302, # too-many-lines
     C0415, # import-outside-toplevel
     R0801, # duplicate-code
+    R0901, # too-many-ancestors
+    R0902, # too-many-instance-attributes
     R0903, # too-few-public-methods
+    R0904, # too-many-public-methods
+    R0911, # too-many-return-statements
+    R0912, # too-many-branches
+    R0913, # too-many-arguments
+    R0914, # too-many-locals
+    R0915, # too-many-statements
+    R0916, # too-many-boolean-expressions
+    R0917, # too-many-positional-arguments
index c578e4a8fdebfaadd9b2d1bdaaab2ea7860ba825..b2c27c0a6dd3a454dc4f4546291aa0e2d85bd7cb 100644 (file)
@@ -297,9 +297,7 @@ def logger(request, system_test_name):
 
 
 @pytest.fixture(scope="module")
-def system_test_dir(
-    request, system_test_name
-):  # pylint: disable=too-many-statements,too-many-locals
+def system_test_dir(request, system_test_name):
     """
     Temporary directory for executing the test.
 
@@ -408,7 +406,7 @@ def system_test_dir(
             unlink(symlink_dst)
 
 
-def _run_script(  # pylint: disable=too-many-arguments
+def _run_script(
     system_test_dir: Path,
     interpreter: str,
     script: str,
@@ -471,7 +469,7 @@ def run_tests_sh(system_test_dir, shell):
 
 
 @pytest.fixture(scope="module", autouse=True)
-def system_test(  # pylint: disable=too-many-arguments,too-many-statements
+def system_test(
     request,
     system_test_dir,
     shell,
index 37eca8a672ce8a92aa724e3c0dfb126e58047c6d..ab508b404ae898b7dd0a8dd4fc041f98f8b4c744 100644 (file)
@@ -97,7 +97,6 @@ class _AsyncUdpHandler(asyncio.DatagramProtocol):
             loop.create_task(handler_coroutine)
 
 
-# pylint: disable=too-few-public-methods
 class AsyncServer:
     """
     A generic asynchronous server which may handle UDP and/or TCP traffic.
@@ -225,7 +224,6 @@ class DnsProtocol(enum.Enum):
     TCP = enum.auto()
 
 
-# pylint: disable=too-many-instance-attributes
 @dataclass
 class QueryContext:
     """
index e0e612fda0ed43f830ecd6a582580b00ae74cf8d..d3b3083262a4122c289a819a93027f3180ab42d5 100644 (file)
@@ -45,7 +45,6 @@ class NamedInstance:
     ```
     """
 
-    # pylint: disable=too-many-arguments
     def __init__(
         self,
         identifier: str,
index b459b15b3eb5ea7df1362deb6270c6e0298fdebd..ea1ec9878e7d33d01529637ccc4311da8e0a2096 100644 (file)
@@ -329,7 +329,6 @@ def check_dnssecstatus(server, zone, keys, policy=None, view=None):
         assert f"key: {key.tag}" in response
 
 
-# pylint: disable=too-many-branches,too-many-locals
 def _check_signatures(signatures, covers, fqdn, keys):
     now = KeyTimingMetadata.now()
     numsigs = 0
@@ -455,7 +454,6 @@ def check_dnskeys(rrset, ksks, zsks, cdnskey=False):
     assert numkeys == len(dnskeys)
 
 
-# pylint: disable=too-many-locals
 def check_cds(rrset, keys):
     # Check if the correct CDS records are published. If the current time
     # is between the timing metadata 'publish' and 'delete', the key must have
index 5662d1e3807b9d3286cb988875db64ed73a7fddc..4c389af2d9f9c6cc3025d19fe5b7afad5e4f943c 100644 (file)
@@ -22,7 +22,6 @@ from isctest.compat import dns_rcode
 QUERY_TIMEOUT = 10
 
 
-# pylint: disable=too-many-arguments
 def generic_query(
     query_func: Callable[..., Any],
     message: dns.message.Message,
index 6e869ab316d63751e7155e74ff63983b3727dad8..d4a0a1bd77cb17f8655a1d4c9508ac202ba447b0 100644 (file)
@@ -14,7 +14,6 @@ import os
 import subprocess
 
 
-# pylint: disable=too-few-public-methods
 class RNDCExecutor(abc.ABC):
     """
     An interface which RNDC executors have to implement in order for the
index b3cb8200c069713c34dfc8c946b6d6ee1a96795b..dd9ac089063b272cb3a226efaec4afff9a2a11eb 100644 (file)
@@ -20,7 +20,7 @@ from isctest.compat import dns_rcode
 import dns.message
 
 
-def cmd(  # pylint: disable=too-many-arguments
+def cmd(
     args,
     cwd=None,
     timeout=60,
index 6caf4e767295ba73d2aa9a309710964813829eab..be2c651aa1b8ac9f00bcb3df82a987e42b02a576 100644 (file)
@@ -9,8 +9,6 @@
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.
 
-# pylint: disable=too-many-lines
-
 from datetime import timedelta
 import difflib
 import os
@@ -97,7 +95,6 @@ def ksr(zone, policy, action, options="", raise_on_exception=True):
     return out.stdout.decode("utf-8"), out.stderr.decode("utf-8")
 
 
-# pylint: disable=too-many-arguments,too-many-branches,too-many-locals,too-many-statements
 def check_keys(
     keys,
     lifetime,
@@ -223,7 +220,6 @@ def check_keysigningrequest(out, zsks, start, end):
     assert line_no == len(lines)
 
 
-# pylint: disable=too-many-arguments,too-many-branches,too-many-locals,too-many-statements
 def check_signedkeyresponse(
     out,
     zone,
@@ -421,7 +417,6 @@ def test_ksr_errors():
     assert "dnssec-ksr: fatal: 'sign' requires a KSR file" in err
 
 
-# pylint: disable=too-many-locals,too-many-statements
 def test_ksr_common(servers):
     # common test cases (1)
     zone = "common.test"
@@ -610,7 +605,6 @@ def test_ksr_common(servers):
     isctest.kasp.check_subdomain(ns1, zone, ksks, overlapping_zsks)
 
 
-# pylint: disable=too-many-locals
 def test_ksr_lastbundle(servers):
     zone = "last-bundle.test"
     policy = "common"
@@ -690,7 +684,6 @@ def test_ksr_lastbundle(servers):
     assert f"zone {zone}/IN (signed): zone_rekey: {warning}" in ns1.log
 
 
-# pylint: disable=too-many-locals
 def test_ksr_inthemiddle(servers):
     zone = "in-the-middle.test"
     policy = "common"
@@ -771,7 +764,6 @@ def test_ksr_inthemiddle(servers):
     assert f"zone {zone}/IN (signed): zone_rekey: {warning}" not in ns1.log
 
 
-# pylint: disable=too-many-locals
 def check_ksr_rekey_logs_error(server, zone, policy, offset, end):
     n = 1
 
@@ -846,7 +838,6 @@ def test_ksr_rekey_logs_error(servers):
     )
 
 
-# pylint: disable=too-many-locals
 def test_ksr_unlimited(servers):
     zone = "unlimited.test"
     policy = "unlimited"
@@ -962,7 +953,6 @@ def test_ksr_unlimited(servers):
     isctest.kasp.check_subdomain(ns1, zone, ksks, zsks)
 
 
-# pylint: disable=too-many-locals
 def test_ksr_twotone(servers):
     zone = "two-tone.test"
     policy = "two-tone"
index 566a84fc8e4791df82d62c221c58ac8501cf5048..93c4c3c704f3ac4d7dc6db1542a858280051804a 100755 (executable)
@@ -61,8 +61,6 @@ def do_work(named_proc, resolver_ip, instance, kill_method, n_workers, n_queries
     :param n_queries: Total number of queries to send
     :type n_queries: int
     """
-    # pylint: disable-msg=too-many-arguments
-    # pylint: disable-msg=too-many-locals
 
     # helper function, 'command' is the rndc command to run
     def launch_rndc(command):
index b474fc1ab879292b84b612d8c004cd37d7003cfa..796da8fbc96b79e45f59b59ba1523c5f2b9b4bd4 100755 (executable)
@@ -35,8 +35,6 @@ import dns.rrset
 
 
 class CraftedTKEYQuery:
-    # pylint: disable=too-few-public-methods
-
     """
     A class for preparing crafted TKEY queries
     """
@@ -81,8 +79,6 @@ class CraftedTKEYQuery:
 
 
 class ASN1Encoder:
-    # pylint: disable=too-few-public-methods
-
     """
     A custom ASN1 encoder which allows preparing malformed GSSAPI tokens
     """
index 7c0a3c95112fc6c90e9e7874ba27906e8da4e632..dc440e292840eaffe1d7519046f859e4b4bce1d0 100644 (file)
@@ -52,7 +52,6 @@ def split_csv(argument, required):
     return outlist
 
 
-# pylint: disable=too-many-statements
 def domain_factory(domainname, domainlabel, todolist, grammar):
     """
     Return parametrized Sphinx domain object.
@@ -318,7 +317,6 @@ def domain_factory(domainname, domainlabel, todolist, grammar):
                     ]
                 )
 
-        # pylint: disable=too-many-arguments
         def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode):
             """
             Sphinx API:
index 0f716fb08553a62741bc23968150a6926f4fcf1b..4f2d9e98cd77ba99aac6a962639e1439faaa25f1 100644 (file)
@@ -26,7 +26,7 @@ from sphinx import addnodes
 try:
     from sphinx.util.docutils import ReferenceRole
 except ImportError:
-    # pylint: disable=too-few-public-methods
+
     class ReferenceRole(roles.GenericRole):
         """
         The ReferenceRole class (used as a base class by GitLabRefRole
index e13e8ec49e630f35d0a4e5d01d0d2359dc0724a1..28afc34bff68c881254a4c72fff9fe4bf2c80d1b 100755 (executable)
@@ -24,9 +24,6 @@ from hashlib import sha256
 class State:
     """Class that holds state of the TSAN parser."""
 
-    # pylint: disable=too-many-instance-attributes
-    # pylint: disable=too-few-public-methods
-
     inside = False
     block = ""
     last_line = None