Repository: ClearcodeHQ/pytest-rabbitmq (language: python)

Issue:
Replace pycodestyle/pydocstyle (pylint?) with ruff



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index cdbb647..803d96a 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -8,4 +8,4 @@ on:
 
 jobs:
   build:
-    uses: fizyk/actions-reuse/.github/workflows/pypi.yml@v1.2.0
+    uses: fizyk/actions-reuse/.github/workflows/pypi.yml@v2.1.2
diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml
index 3052dc4..3704c8e 100644
--- a/.github/workflows/linters.yml
+++ b/.github/workflows/linters.yml
@@ -10,5 +10,4 @@ jobs:
     uses: fizyk/actions-reuse/.github/workflows/linters-python.yml@v2.1.2
     with:
       black: true
-      pycodestyle: true
-      pydocstyle: true
+      ruff: true
diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml
index e6543ef..f90d2ce 100644
--- a/.github/workflows/pypi.yml
+++ b/.github/workflows/pypi.yml
@@ -5,7 +5,7 @@ on:
       - v*
 jobs:
   build:
-    uses: fizyk/actions-reuse/.github/workflows/pypi.yml@v1.2.0
+    uses: fizyk/actions-reuse/.github/workflows/pypi.yml@v2.1.2
     with:
       publish: true
     secrets:
diff --git a/Pipfile b/Pipfile
index c617cd4..92ff5a2 100644
--- a/Pipfile
+++ b/Pipfile
@@ -13,9 +13,8 @@ mirakuru = "==2.5.1"
 towncrier = "==22.12"
 pytest-cov = "==4.0"
 pytest-xdist = "==3.3.1"
-pycodestyle = "==2.10.0"
-pydocstyle = "==6.3.0"
 black = "==23.3.0"
+ruff = "==0.0.270"
 
 [requires]
 python_version = "3.9"
diff --git a/Pipfile.lock b/Pipfile.lock
index b328313..fd76dbd 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,7 +1,7 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "dceed3065b9a0a4fe2bc0e4cc0c608d813cf986e10e5e6e06612c6f094e150b9"
+            "sha256": "93ff2d24ca205b373230ad363c7ce34c9b9b5b3f5e062025f9f9217286fd2170"
         },
         "pipfile-spec": 6,
         "requires": {
@@ -16,14 +16,6 @@
         ]
     },
     "default": {
-        "exceptiongroup": {
-            "hashes": [
-                "sha256:232c37c63e4f682982c8b6459f33a8981039e5fb8756b2074364e5055c498c9e",
-                "sha256:d484c3090ba2889ae2928419117447a14daf3c1231d5e30d0aae34f354f01785"
-            ],
-            "markers": "python_version < '3.11'",
-            "version": "==1.1.1"
-        },
         "iniconfig": {
             "hashes": [
                 "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3",
@@ -99,14 +91,6 @@
             ],
             "index": "pypi",
             "version": "==7.3.1"
-        },
-        "tomli": {
-            "hashes": [
-                "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc",
-                "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"
-            ],
-            "markers": "python_version < '3.11'",
-            "version": "==2.0.1"
         }
     },
     "develop": {
@@ -224,14 +208,6 @@
             "markers": "python_version >= '3.7'",
             "version": "==7.2.7"
         },
-        "exceptiongroup": {
-            "hashes": [
-                "sha256:232c37c63e4f682982c8b6459f33a8981039e5fb8756b2074364e5055c498c9e",
-                "sha256:d484c3090ba2889ae2928419117447a14daf3c1231d5e30d0aae34f354f01785"
-            ],
-            "markers": "python_version < '3.11'",
-            "version": "==1.1.1"
-        },
         "execnet": {
             "hashes": [
                 "sha256:8f694f3ba9cc92cab508b152dcfe322153975c29bda272e2fd7f3f00f36e47c5",
@@ -359,22 +335,6 @@
             "markers": "python_version >= '3.6'",
             "version": "==1.0.0"
         },
-        "pycodestyle": {
-            "hashes": [
-                "sha256:347187bdb476329d98f695c213d7295a846d1152ff4fe9bacb8a9590b8ee7053",
-                "sha256:8a4eaf0d0495c7395bdab3589ac2db602797d76207242c17d470186815706610"
-            ],
-            "index": "pypi",
-            "version": "==2.10.0"
-        },
-        "pydocstyle": {
-            "hashes": [
-                "sha256:118762d452a49d6b05e194ef344a55822987a462831ade91ec5c06fd2169d019",
-                "sha256:7ce43f0c0ac87b07494eb9c0b462c0b73e6ff276807f204d6b53edc72b7e44e1"
-            ],
-            "index": "pypi",
-            "version": "==6.3.0"
-        },
         "pytest": {
             "hashes": [
                 "sha256:3799fa815351fea3a5e96ac7e503a96fa51cc9942c3753cda7651b93c1cfa362",
@@ -399,6 +359,29 @@
             "index": "pypi",
             "version": "==3.3.1"
         },
+        "ruff": {
+            "hashes": [
+                "sha256:0012f9b7dc137ab7f1f0355e3c4ca49b562baf6c9fa1180948deeb6648c52957",
+                "sha256:08188f8351f4c0b6216e8463df0a76eb57894ca59a3da65e4ed205db980fd3ae",
+                "sha256:0827b074635d37984fc98d99316bfab5c8b1231bb83e60dacc83bd92883eedb4",
+                "sha256:0bbfbf6fd2436165566ca85f6e57be03ed2f0a994faf40180cfbb3604c9232ef",
+                "sha256:0d61ae4841313f6eeb8292dc349bef27b4ce426e62c36e80ceedc3824e408734",
+                "sha256:0eb412f20e77529a01fb94d578b19dcb8331b56f93632aa0cce4a2ea27b7aeba",
+                "sha256:21f00e47ab2308617c44435c8dfd9e2e03897461c9e647ec942deb2a235b4cfd",
+                "sha256:3ed3b198768d2b3a2300fb18f730cd39948a5cc36ba29ae9d4639a11040880be",
+                "sha256:643de865fd35cb76c4f0739aea5afe7b8e4d40d623df7e9e6ea99054e5cead0a",
+                "sha256:739495d2dbde87cf4e3110c8d27bc20febf93112539a968a4e02c26f0deccd1d",
+                "sha256:8af391ef81f7be960be10886a3c1aac0b298bde7cb9a86ec2b05faeb2081ce6b",
+                "sha256:95db07b7850b30ebf32b27fe98bc39e0ab99db3985edbbf0754d399eb2f0e690",
+                "sha256:9613456b0b375766244c25045e353bc8890c856431cd97893c97b10cc93bd28d",
+                "sha256:b4c037fe2f75bcd9aed0c89c7c507cb7fa59abae2bd4c8b6fc331a28178655a4",
+                "sha256:b775e2c5fc869359daf8c8b8aa0fd67240201ab2e8d536d14a0edf279af18786",
+                "sha256:eca02e709b3308eb7255b5f74e779be23b5980fca3862eae28bb23069cd61ae4",
+                "sha256:f74c4d550f7b8e808455ac77bbce38daafc458434815ba0bc21ae4bdb276509b"
+            ],
+            "index": "pypi",
+            "version": "==0.0.270"
+        },
         "setuptools": {
             "hashes": [
                 "sha256:5df61bf30bb10c6f756eb19e7c9f3b473051f48db77fddbe06ff2ca307df9a6f",
@@ -407,21 +390,6 @@
             "markers": "python_version >= '3.7'",
             "version": "==67.8.0"
         },
-        "snowballstemmer": {
-            "hashes": [
-                "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1",
-                "sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a"
-            ],
-            "version": "==2.2.0"
-        },
-        "tomli": {
-            "hashes": [
-                "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc",
-                "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"
-            ],
-            "markers": "python_version < '3.11'",
-            "version": "==2.0.1"
-        },
         "towncrier": {
             "hashes": [
                 "sha256:9767a899a4d6856950f3598acd9e8f08da2663c49fdcda5ea0f9e6ba2afc8eea",
@@ -429,14 +397,6 @@
             ],
             "index": "pypi",
             "version": "==22.12"
-        },
-        "typing-extensions": {
-            "hashes": [
-                "sha256:88a4153d8505aabbb4e13aacb7c486c2b4a33ca3b3f807914a9b4c844c471c26",
-                "sha256:d91d5919357fe7f681a9f2b5b4cb2a5f1ef0a1e9f59c4d8ff0d3491e05c0ffd5"
-            ],
-            "markers": "python_version < '3.10'",
-            "version": "==4.6.3"
         }
     }
 }
diff --git a/newsfragments/322.misc.rst b/newsfragments/322.misc.rst
new file mode 100644
index 0000000..d0ea4e8
--- /dev/null
+++ b/newsfragments/322.misc.rst
@@ -0,0 +1,1 @@
+Replace pycodestyle and pydocstyle with ruff.
\ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
index b5eef48..d556991 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -65,6 +65,16 @@ line-length = 100
 target-version = ['py38']
 include = '.*\.pyi?$'
 
+[tool.ruff]
+# Decrease the maximum line length to 79 characters.
+line-length = 100
+select = [
+    "E",   # pycodestyle
+    "F",   # pyflakes
+    "I",   # isort
+    "D",   # pydocstyle
+]
+
 [tool.towncrier]
 directory = "newsfragments"
 single_file=true


Test patch:
diff --git a/pytest_rabbitmq/factories/client.py b/pytest_rabbitmq/factories/client.py
index 0f74729..453e23c 100644
--- a/pytest_rabbitmq/factories/client.py
+++ b/pytest_rabbitmq/factories/client.py
@@ -19,18 +19,16 @@
 import logging
 
 import pytest
-
-from pika.credentials import PlainCredentials
 from pika import ConnectionParameters
-from pika.adapters.blocking_connection import BlockingConnection, BlockingChannel
+from pika.adapters.blocking_connection import BlockingConnection
+from pika.credentials import PlainCredentials
 from pika.exceptions import ChannelClosed
 
 logger = logging.getLogger("pytest-rabbitmq")
 
 
 def clear_rabbitmq(process, rabbitmq_connection):
-    """
-    Clear queues and exchanges from given rabbitmq process.
+    """Clear queues and exchanges from given rabbitmq process.
 
     :param RabbitMqExecutor process: rabbitmq process
     :param pika.connection.Connection rabbitmq_connection: connection to rabbitmq
@@ -68,8 +66,7 @@ def clear_rabbitmq(process, rabbitmq_connection):
 
 
 def rabbitmq(process_fixture_name, teardown=clear_rabbitmq):
-    """
-    Client fixture factory for RabbitMQ.
+    """Client fixture factory for RabbitMQ.
 
     :param str process_fixture_name: name of RabbitMQ process variable
         returned by rabbitmq_proc
@@ -87,8 +84,7 @@ def rabbitmq(process_fixture_name, teardown=clear_rabbitmq):
 
     @pytest.fixture
     def rabbitmq_factory(request):
-        """
-        Client fixture for RabbitMQ.
+        """Client fixture for RabbitMQ.
 
         #. Get module and config.
         #. Connect to RabbitMQ using the parameters from config.
diff --git a/pytest_rabbitmq/factories/executor.py b/pytest_rabbitmq/factories/executor.py
index 59176e6..18929b7 100644
--- a/pytest_rabbitmq/factories/executor.py
+++ b/pytest_rabbitmq/factories/executor.py
@@ -22,8 +22,7 @@ def __init__(
         node_name=None,
         **kwargs,
     ):  # pylint:disable=too-many-arguments
-        """
-        Initialize RabbitMQ executor.
+        """Initialize RabbitMQ executor.
 
         :param str command: rabbitmq-server location
         :param str host: host where rabbitmq will be accessible
@@ -47,8 +46,7 @@ def __init__(
         self.rabbit_ctl = rabbit_ctl
 
     def rabbitctl_output(self, *args):
-        """
-        Query rabbitctl with args.
+        """Query rabbitctl with args.
 
         :param list args: list of additional args to query
         """
diff --git a/pytest_rabbitmq/factories/process.py b/pytest_rabbitmq/factories/process.py
index b4c4364..3212126 100644
--- a/pytest_rabbitmq/factories/process.py
+++ b/pytest_rabbitmq/factories/process.py
@@ -47,8 +47,7 @@ def rabbitmq_proc(
     logsdir=None,
     plugindir=None,
 ):
-    """
-    Fixture factory for RabbitMQ process.
+    """Fixture factory for RabbitMQ process.
 
     :param str server: path to rabbitmq-server command
     :param str host: server host
@@ -70,8 +69,7 @@ def rabbitmq_proc(
 
     @pytest.fixture(scope="session")
     def rabbitmq_proc_fixture(request):
-        """
-        Fixture for RabbitMQ process.
+        """Fixture for RabbitMQ process.
 
         #. Get config.
         #. Make a temporary directory.
diff --git a/pytest_rabbitmq/plugin.py b/pytest_rabbitmq/plugin.py
index 9467bdf..49a4541 100644
--- a/pytest_rabbitmq/plugin.py
+++ b/pytest_rabbitmq/plugin.py
@@ -20,7 +20,6 @@
 
 from pytest_rabbitmq import factories
 
-
 # pylint:disable=invalid-name
 _help_ctl = "RabbitMQ ctl path"
 _help_server = "RabbitMQ server path"
diff --git a/tests/conftest.py b/tests/conftest.py
index b03dfc2..a14b1e1 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,6 +1,6 @@
 """Tests main conftest file."""
-from pytest_rabbitmq.plugin import *
 from pytest_rabbitmq import factories
+from pytest_rabbitmq.plugin import *  # noqa: F403
 
 # pylint:disable=invalid-name
 rabbitmq_proc2 = factories.rabbitmq_proc(port=5674, node="test2")