From 8a5d4adefa74c7b59c6cbf9395ca1c84b6066230 Mon Sep 17 00:00:00 2001 From: Georgy Moiseev Date: Sun, 22 Sep 2024 19:28:49 +0300 Subject: [PATCH 1/3] pylint: ignore too-many-positional-arguments Pylint 3.3.0 includes a new warning: too-many-positional-arguments [1]. We already ignore a similar too-many-arguments warning in several places since "fixing" it is backward-incompatible. 1. https://github.com/pylint-dev/pylint/issues/9099 --- tarantool/__init__.py | 2 +- tarantool/connection.py | 2 +- tarantool/connection_pool.py | 2 +- tarantool/mesh_connection.py | 2 +- tarantool/request.py | 8 ++++---- test/suites/lib/tarantool_server.py | 2 +- test/suites/test_ssl.py | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tarantool/__init__.py b/tarantool/__init__.py index d7e99358..97a1e860 100644 --- a/tarantool/__init__.py +++ b/tarantool/__init__.py @@ -1,7 +1,7 @@ """ This package provides API for interaction with a Tarantool server. """ -# pylint: disable=too-many-arguments +# pylint: disable=too-many-arguments,too-many-positional-arguments from tarantool.connection import Connection from tarantool.mesh_connection import MeshConnection diff --git a/tarantool/connection.py b/tarantool/connection.py index 1284fa25..682b0700 100644 --- a/tarantool/connection.py +++ b/tarantool/connection.py @@ -812,7 +812,7 @@ def __init__(self, .. _mp_bin: https://github.com/msgpack/msgpack/blob/master/spec.md#bin-format-family .. _mp_array: https://github.com/msgpack/msgpack/blob/master/spec.md#array-format-family """ - # pylint: disable=too-many-arguments,too-many-locals,too-many-statements + # pylint: disable=too-many-arguments,too-many-locals,too-many-statements,too-many-positional-arguments if host is None and port is None and socket_fd is None: raise ConfigurationError("need to specify host/port, " diff --git a/tarantool/connection_pool.py b/tarantool/connection_pool.py index 7bbd4e16..f1e675b3 100644 --- a/tarantool/connection_pool.py +++ b/tarantool/connection_pool.py @@ -482,7 +482,7 @@ def __init__(self, .. _box.info.status: .. _box.info: https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_info/ """ - # pylint: disable=too-many-arguments,too-many-locals + # pylint: disable=too-many-arguments,too-many-locals,too-many-positional-arguments if not isinstance(addrs, list) or len(addrs) == 0: raise ConfigurationError("addrs must be non-empty list") diff --git a/tarantool/mesh_connection.py b/tarantool/mesh_connection.py index 0f86c0dd..02a20d7d 100644 --- a/tarantool/mesh_connection.py +++ b/tarantool/mesh_connection.py @@ -463,7 +463,7 @@ def __init__(self, :class:`~tarantool.Connection` exceptions, :class:`~tarantool.MeshConnection.connect` exceptions """ - # pylint: disable=too-many-arguments,too-many-locals + # pylint: disable=too-many-arguments,too-many-locals,too-many-positional-arguments if addrs is None: addrs = [] diff --git a/tarantool/request.py b/tarantool/request.py index d8d4dd22..95164b79 100644 --- a/tarantool/request.py +++ b/tarantool/request.py @@ -269,7 +269,7 @@ def __init__(self, conn, salt, user, password, auth_type=AUTH_TYPE_CHAP_SHA1): :param auth_type: Refer to :paramref:`~tarantool.Connection.auth_type`. :type auth_type: :obj:`str`, optional """ - # pylint: disable=too-many-arguments + # pylint: disable=too-many-arguments,too-many-positional-arguments super().__init__(conn) @@ -405,7 +405,7 @@ def __init__(self, conn, space_no, index_no, key, offset, limit, iterator): :raise: :exc:`~AssertionError` """ - # pylint: disable=too-many-arguments + # pylint: disable=too-many-arguments,too-many-positional-arguments super().__init__(conn) request_body = self._dumps({IPROTO_SPACE_ID: space_no, @@ -446,7 +446,7 @@ def __init__(self, conn, space_no, index_no, key, op_list): :raise: :exc:`~AssertionError` """ - # pylint: disable=too-many-arguments + # pylint: disable=too-many-arguments,too-many-positional-arguments super().__init__(conn) @@ -569,7 +569,7 @@ def __init__(self, conn, space_no, index_no, tuple_value, op_list): :raise: :exc:`~AssertionError` """ - # pylint: disable=too-many-arguments + # pylint: disable=too-many-arguments,too-many-positional-arguments super().__init__(conn) diff --git a/test/suites/lib/tarantool_server.py b/test/suites/lib/tarantool_server.py index c8f34b37..55f6ca63 100644 --- a/test/suites/lib/tarantool_server.py +++ b/test/suites/lib/tarantool_server.py @@ -56,7 +56,7 @@ class TarantoolServer(): """ Class to start up a new Tarantool server. """ - # pylint: disable=too-many-instance-attributes,too-many-arguments,duplicate-code + # pylint: disable=too-many-instance-attributes,too-many-arguments,duplicate-code,too-many-positional-arguments default_tarantool = { "bin": "tarantool", diff --git a/test/suites/test_ssl.py b/test/suites/test_ssl.py index 9452e83b..b7d1da97 100644 --- a/test/suites/test_ssl.py +++ b/test/suites/test_ssl.py @@ -34,7 +34,7 @@ def is_test_ssl(): class SslTestCase: - # pylint: disable=too-few-public-methods,too-many-instance-attributes,too-many-arguments + # pylint: disable=too-few-public-methods,too-many-instance-attributes,too-many-arguments,too-many-positional-arguments def __init__(self, name="", From b09a617247c4026ddc41bdc24ca671348ce185ae Mon Sep 17 00:00:00 2001 From: Georgy Moiseev Date: Sun, 22 Sep 2024 19:51:59 +0300 Subject: [PATCH 2/3] pylint: ignore unknown-option-value Disabling any new pylint warnings per-entity results in older pylint failing due to unknown option. Since we support several pylint versions due to Python version restrictions, we need to support multiple pylint versions as well. --- .pylintrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pylintrc b/.pylintrc index 3fd8b942..385d67ad 100644 --- a/.pylintrc +++ b/.pylintrc @@ -6,3 +6,8 @@ good-names=i,j,k,ex,Run,_,ok,t,tz [FORMAT] # Allow links in docstings, allow tables ignore-long-lines=^(?:\s*(# )?(?:\.\.\s.+?:)?\s*?)|(\s\+.+\+)|(\s\|.+\|)$ + +[MESSAGES CONTROL] +# Ignore unknown options to support per-entity ignores for newest warnings/errors +# which are not supported for older versions. +disable=unknown-option-value From 7726a9123b6b99e3b84d5567493a9287d200aafa Mon Sep 17 00:00:00 2001 From: Georgy Moiseev Date: Sun, 22 Sep 2024 19:41:06 +0300 Subject: [PATCH 3/3] test: fixate linters version strictly Any new linter release, including bugfix ones, may result in failing CI. Since tarantool-python CI is included in several integration pipelines, such things may block work on repos like tarantool/tarantool and tarantool/luajit. On the other hand, if CI will start to fail due to a new linter release, it is unlikely that something user-critical will be discovered. So for now let's stick to the following approach: one will bump linters manually from time to time and fix/disable emerging issues. --- requirements-test.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/requirements-test.txt b/requirements-test.txt index 56f4b595..4d16b8ca 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,8 +1,10 @@ git+https://github.com/baztian/dbapi-compliance.git@ea7cb1b4#egg=dbapi-compliance pyyaml==6.0 importlib-metadata >= 1.0 ; python_version < '3.8' -pylint ~= 3.0 ; python_version >= '3.8' -pylint ~= 2.13 ; python_version < '3.8' -flake8 ~= 6.1 ; python_version >= '3.8' -flake8 ~= 5.0 ; python_version < '3.8' -codespell ~= 2.2 +pylint == 3.3.0 ; python_version >= '3.9' +pylint == 3.2.7 ; python_version == '3.8' +pylint == 2.17.7 ; python_version == '3.7' +flake8 == 6.1.0 ; python_version >= '3.8' +flake8 == 5.0.4 ; python_version < '3.8' +codespell == 2.3.0 ; python_version >= '3.8' +codespell == 2.2.5 ; python_version < '3.8'