mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 01:59:26 +00:00
Disable too-many/too-few pylint checks
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.
This commit is contained in:
parent
d7fab54393
commit
7639c58c48
11
.pylintrc
11
.pylintrc
@ -12,6 +12,17 @@ disable=
|
|||||||
C0116, # missing-function-docstring
|
C0116, # missing-function-docstring
|
||||||
C0209, # consider-using-f-string
|
C0209, # consider-using-f-string
|
||||||
C0301, # line-too-long, handled better by black
|
C0301, # line-too-long, handled better by black
|
||||||
|
C0302, # too-many-lines
|
||||||
C0415, # import-outside-toplevel
|
C0415, # import-outside-toplevel
|
||||||
R0801, # duplicate-code
|
R0801, # duplicate-code
|
||||||
|
R0901, # too-many-ancestors
|
||||||
|
R0902, # too-many-instance-attributes
|
||||||
R0903, # too-few-public-methods
|
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
|
||||||
|
@ -297,9 +297,7 @@ def logger(request, system_test_name):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def system_test_dir(
|
def system_test_dir(request, system_test_name):
|
||||||
request, system_test_name
|
|
||||||
): # pylint: disable=too-many-statements,too-many-locals
|
|
||||||
"""
|
"""
|
||||||
Temporary directory for executing the test.
|
Temporary directory for executing the test.
|
||||||
|
|
||||||
@ -408,7 +406,7 @@ def system_test_dir(
|
|||||||
unlink(symlink_dst)
|
unlink(symlink_dst)
|
||||||
|
|
||||||
|
|
||||||
def _run_script( # pylint: disable=too-many-arguments
|
def _run_script(
|
||||||
system_test_dir: Path,
|
system_test_dir: Path,
|
||||||
interpreter: str,
|
interpreter: str,
|
||||||
script: str,
|
script: str,
|
||||||
@ -471,7 +469,7 @@ def run_tests_sh(system_test_dir, shell):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module", autouse=True)
|
@pytest.fixture(scope="module", autouse=True)
|
||||||
def system_test( # pylint: disable=too-many-arguments,too-many-statements
|
def system_test(
|
||||||
request,
|
request,
|
||||||
system_test_dir,
|
system_test_dir,
|
||||||
shell,
|
shell,
|
||||||
|
@ -97,7 +97,6 @@ class _AsyncUdpHandler(asyncio.DatagramProtocol):
|
|||||||
loop.create_task(handler_coroutine)
|
loop.create_task(handler_coroutine)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
class AsyncServer:
|
class AsyncServer:
|
||||||
"""
|
"""
|
||||||
A generic asynchronous server which may handle UDP and/or TCP traffic.
|
A generic asynchronous server which may handle UDP and/or TCP traffic.
|
||||||
@ -225,7 +224,6 @@ class DnsProtocol(enum.Enum):
|
|||||||
TCP = enum.auto()
|
TCP = enum.auto()
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class QueryContext:
|
class QueryContext:
|
||||||
"""
|
"""
|
||||||
|
@ -45,7 +45,6 @@ class NamedInstance:
|
|||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
identifier: str,
|
identifier: str,
|
||||||
|
@ -329,7 +329,6 @@ def check_dnssecstatus(server, zone, keys, policy=None, view=None):
|
|||||||
assert f"key: {key.tag}" in response
|
assert f"key: {key.tag}" in response
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-branches,too-many-locals
|
|
||||||
def _check_signatures(signatures, covers, fqdn, keys):
|
def _check_signatures(signatures, covers, fqdn, keys):
|
||||||
now = KeyTimingMetadata.now()
|
now = KeyTimingMetadata.now()
|
||||||
numsigs = 0
|
numsigs = 0
|
||||||
@ -455,7 +454,6 @@ def check_dnskeys(rrset, ksks, zsks, cdnskey=False):
|
|||||||
assert numkeys == len(dnskeys)
|
assert numkeys == len(dnskeys)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-locals
|
|
||||||
def check_cds(rrset, keys):
|
def check_cds(rrset, keys):
|
||||||
# Check if the correct CDS records are published. If the current time
|
# Check if the correct CDS records are published. If the current time
|
||||||
# is between the timing metadata 'publish' and 'delete', the key must have
|
# is between the timing metadata 'publish' and 'delete', the key must have
|
||||||
|
@ -22,7 +22,6 @@ from isctest.compat import dns_rcode
|
|||||||
QUERY_TIMEOUT = 10
|
QUERY_TIMEOUT = 10
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def generic_query(
|
def generic_query(
|
||||||
query_func: Callable[..., Any],
|
query_func: Callable[..., Any],
|
||||||
message: dns.message.Message,
|
message: dns.message.Message,
|
||||||
|
@ -14,7 +14,6 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
class RNDCExecutor(abc.ABC):
|
class RNDCExecutor(abc.ABC):
|
||||||
"""
|
"""
|
||||||
An interface which RNDC executors have to implement in order for the
|
An interface which RNDC executors have to implement in order for the
|
||||||
|
@ -20,7 +20,7 @@ from isctest.compat import dns_rcode
|
|||||||
import dns.message
|
import dns.message
|
||||||
|
|
||||||
|
|
||||||
def cmd( # pylint: disable=too-many-arguments
|
def cmd(
|
||||||
args,
|
args,
|
||||||
cwd=None,
|
cwd=None,
|
||||||
timeout=60,
|
timeout=60,
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
# See the COPYRIGHT file distributed with this work for additional
|
# See the COPYRIGHT file distributed with this work for additional
|
||||||
# information regarding copyright ownership.
|
# information regarding copyright ownership.
|
||||||
|
|
||||||
# pylint: disable=too-many-lines
|
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import difflib
|
import difflib
|
||||||
import os
|
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")
|
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(
|
def check_keys(
|
||||||
keys,
|
keys,
|
||||||
lifetime,
|
lifetime,
|
||||||
@ -223,7 +220,6 @@ def check_keysigningrequest(out, zsks, start, end):
|
|||||||
assert line_no == len(lines)
|
assert line_no == len(lines)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments,too-many-branches,too-many-locals,too-many-statements
|
|
||||||
def check_signedkeyresponse(
|
def check_signedkeyresponse(
|
||||||
out,
|
out,
|
||||||
zone,
|
zone,
|
||||||
@ -421,7 +417,6 @@ def test_ksr_errors():
|
|||||||
assert "dnssec-ksr: fatal: 'sign' requires a KSR file" in err
|
assert "dnssec-ksr: fatal: 'sign' requires a KSR file" in err
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-locals,too-many-statements
|
|
||||||
def test_ksr_common(servers):
|
def test_ksr_common(servers):
|
||||||
# common test cases (1)
|
# common test cases (1)
|
||||||
zone = "common.test"
|
zone = "common.test"
|
||||||
@ -610,7 +605,6 @@ def test_ksr_common(servers):
|
|||||||
isctest.kasp.check_subdomain(ns1, zone, ksks, overlapping_zsks)
|
isctest.kasp.check_subdomain(ns1, zone, ksks, overlapping_zsks)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-locals
|
|
||||||
def test_ksr_lastbundle(servers):
|
def test_ksr_lastbundle(servers):
|
||||||
zone = "last-bundle.test"
|
zone = "last-bundle.test"
|
||||||
policy = "common"
|
policy = "common"
|
||||||
@ -690,7 +684,6 @@ def test_ksr_lastbundle(servers):
|
|||||||
assert f"zone {zone}/IN (signed): zone_rekey: {warning}" in ns1.log
|
assert f"zone {zone}/IN (signed): zone_rekey: {warning}" in ns1.log
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-locals
|
|
||||||
def test_ksr_inthemiddle(servers):
|
def test_ksr_inthemiddle(servers):
|
||||||
zone = "in-the-middle.test"
|
zone = "in-the-middle.test"
|
||||||
policy = "common"
|
policy = "common"
|
||||||
@ -771,7 +764,6 @@ def test_ksr_inthemiddle(servers):
|
|||||||
assert f"zone {zone}/IN (signed): zone_rekey: {warning}" not in ns1.log
|
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):
|
def check_ksr_rekey_logs_error(server, zone, policy, offset, end):
|
||||||
n = 1
|
n = 1
|
||||||
|
|
||||||
@ -846,7 +838,6 @@ def test_ksr_rekey_logs_error(servers):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-locals
|
|
||||||
def test_ksr_unlimited(servers):
|
def test_ksr_unlimited(servers):
|
||||||
zone = "unlimited.test"
|
zone = "unlimited.test"
|
||||||
policy = "unlimited"
|
policy = "unlimited"
|
||||||
@ -962,7 +953,6 @@ def test_ksr_unlimited(servers):
|
|||||||
isctest.kasp.check_subdomain(ns1, zone, ksks, zsks)
|
isctest.kasp.check_subdomain(ns1, zone, ksks, zsks)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-locals
|
|
||||||
def test_ksr_twotone(servers):
|
def test_ksr_twotone(servers):
|
||||||
zone = "two-tone.test"
|
zone = "two-tone.test"
|
||||||
policy = "two-tone"
|
policy = "two-tone"
|
||||||
|
@ -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
|
:param n_queries: Total number of queries to send
|
||||||
:type n_queries: int
|
: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
|
# helper function, 'command' is the rndc command to run
|
||||||
def launch_rndc(command):
|
def launch_rndc(command):
|
||||||
|
@ -35,8 +35,6 @@ import dns.rrset
|
|||||||
|
|
||||||
|
|
||||||
class CraftedTKEYQuery:
|
class CraftedTKEYQuery:
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
A class for preparing crafted TKEY queries
|
A class for preparing crafted TKEY queries
|
||||||
"""
|
"""
|
||||||
@ -81,8 +79,6 @@ class CraftedTKEYQuery:
|
|||||||
|
|
||||||
|
|
||||||
class ASN1Encoder:
|
class ASN1Encoder:
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
A custom ASN1 encoder which allows preparing malformed GSSAPI tokens
|
A custom ASN1 encoder which allows preparing malformed GSSAPI tokens
|
||||||
"""
|
"""
|
||||||
|
@ -52,7 +52,6 @@ def split_csv(argument, required):
|
|||||||
return outlist
|
return outlist
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-statements
|
|
||||||
def domain_factory(domainname, domainlabel, todolist, grammar):
|
def domain_factory(domainname, domainlabel, todolist, grammar):
|
||||||
"""
|
"""
|
||||||
Return parametrized Sphinx domain object.
|
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):
|
def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode):
|
||||||
"""
|
"""
|
||||||
Sphinx API:
|
Sphinx API:
|
||||||
|
@ -26,7 +26,7 @@ from sphinx import addnodes
|
|||||||
try:
|
try:
|
||||||
from sphinx.util.docutils import ReferenceRole
|
from sphinx.util.docutils import ReferenceRole
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
class ReferenceRole(roles.GenericRole):
|
class ReferenceRole(roles.GenericRole):
|
||||||
"""
|
"""
|
||||||
The ReferenceRole class (used as a base class by GitLabRefRole
|
The ReferenceRole class (used as a base class by GitLabRefRole
|
||||||
|
@ -24,9 +24,6 @@ from hashlib import sha256
|
|||||||
class State:
|
class State:
|
||||||
"""Class that holds state of the TSAN parser."""
|
"""Class that holds state of the TSAN parser."""
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
|
|
||||||
inside = False
|
inside = False
|
||||||
block = ""
|
block = ""
|
||||||
last_line = None
|
last_line = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user