From d4fb094ee8b92f81e62be4f8ae95108b3e0da80d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicki=20K=C5=99=C3=AD=C5=BEek?= Date: Mon, 14 Oct 2024 14:44:06 +0200 Subject: [PATCH] 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. (cherry picked from commit 7639c58c4889003777e5da36567f84caa424f157) --- .pylintrc | 12 ++++++++++++ bin/tests/system/shutdown/tests_shutdown.py | 2 -- bin/tests/system/tsiggss/tests_isc_spnego_flaws.py | 4 ---- doc/arm/conf.py | 2 +- util/parse_tsan.py | 3 --- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.pylintrc b/.pylintrc index f9b1110547..2998c45800 100644 --- a/.pylintrc +++ b/.pylintrc @@ -5,5 +5,17 @@ disable= C0115, # missing-class-docstring C0116, # missing-function-docstring C0209, # consider-using-f-string + 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 diff --git a/bin/tests/system/shutdown/tests_shutdown.py b/bin/tests/system/shutdown/tests_shutdown.py index 1eb502890a..11fb673a3f 100755 --- a/bin/tests/system/shutdown/tests_shutdown.py +++ b/bin/tests/system/shutdown/tests_shutdown.py @@ -60,8 +60,6 @@ def do_work(named_proc, resolver, rndc_cmd, 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, args must be a list or tuple with arguments to rndc. def launch_rndc(args): diff --git a/bin/tests/system/tsiggss/tests_isc_spnego_flaws.py b/bin/tests/system/tsiggss/tests_isc_spnego_flaws.py index 6340b5abf8..91ad859616 100755 --- a/bin/tests/system/tsiggss/tests_isc_spnego_flaws.py +++ b/bin/tests/system/tsiggss/tests_isc_spnego_flaws.py @@ -34,8 +34,6 @@ import dns.rrset class CraftedTKEYQuery: - # pylint: disable=too-few-public-methods - """ A class for preparing crafted TKEY queries """ @@ -80,8 +78,6 @@ class CraftedTKEYQuery: class ASN1Encoder: - # pylint: disable=too-few-public-methods - """ A custom ASN1 encoder which allows preparing malformed GSSAPI tokens """ diff --git a/doc/arm/conf.py b/doc/arm/conf.py index f2dd2e6092..9f54fbe27f 100644 --- a/doc/arm/conf.py +++ b/doc/arm/conf.py @@ -22,7 +22,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 diff --git a/util/parse_tsan.py b/util/parse_tsan.py index f533ca9c95..7a1d2b6d5e 100755 --- a/util/parse_tsan.py +++ b/util/parse_tsan.py @@ -23,9 +23,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