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

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



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml
index 11fe814..534e3b3 100644
--- a/.github/workflows/linters.yml
+++ b/.github/workflows/linters.yml
@@ -3,10 +3,6 @@ name: Run linters
 on:
   push:
     branches: [ main ]
-    paths:
-      - '**.py'
-      - .github/workflows/linters.yml
-      - requirements-lint.txt
   pull_request:
     branches: [ main ]
 
@@ -14,6 +10,5 @@ jobs:
   lint:
     uses: fizyk/actions-reuse/.github/workflows/linters-python.yml@v2.1.2
     with:
-      pydocstyle: true
-      pycodestyle: true
+      ruff: true
       black: true
diff --git a/Pipfile b/Pipfile
index 0757e75..aa9ec85 100644
--- a/Pipfile
+++ b/Pipfile
@@ -11,8 +11,7 @@ pymongo = "==4.3.3"
 
 [dev-packages]
 towncrier = "==23.6.0"
-pycodestyle = "==2.10.0"
-pydocstyle = "==6.3.0"
 black = "==23.3.0"
 pytest-cov = "==4.0.0"
 pytest-xdist = "==3.0.2"
+ruff = "==0.0.272"
diff --git a/Pipfile.lock b/Pipfile.lock
index 02f1dc2..5992a65 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,7 +1,7 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "c9d3f4af8c5a0c5558942e6a7a9527b3ac8ecc065f47eacb218ff4dbc8e08532"
+            "sha256": "faf23fa9c1f10757789e653b1be2f93bb394961c0708ebb6c27c49fddc82662c"
         },
         "pipfile-spec": 6,
         "requires": {},
@@ -56,11 +56,11 @@
         },
         "pluggy": {
             "hashes": [
-                "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159",
-                "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"
+                "sha256:c500b592c5512df35622e4faf2135aa0b7e989c7d31344194b4afb9d5e47b1bf",
+                "sha256:d81d19a3a88d82ed06998353ce5d5c02587ef07ee2d808ae63904ab0ccef0087"
             ],
-            "markers": "python_version >= '3.6'",
-            "version": "==1.0.0"
+            "markers": "python_version >= '3.7'",
+            "version": "==1.1.0"
         },
         "port-for": {
             "hashes": [
@@ -180,6 +180,14 @@
         }
     },
     "develop": {
+        "attrs": {
+            "hashes": [
+                "sha256:1f28b4522cdc2fb4256ac1a020c78acf9cba2c6b461ccd2c126f3aa8e8335d04",
+                "sha256:6279836d581513a26f1bf235f9acd333bc9115683f14f7e8fae46c98fc50e015"
+            ],
+            "markers": "python_version >= '3.7'",
+            "version": "==23.1.0"
+        },
         "black": {
             "hashes": [
                 "sha256:064101748afa12ad2291c2b91c960be28b817c0c7eaa35bec09cc63aa56493c5",
@@ -415,27 +423,11 @@
         },
         "pluggy": {
             "hashes": [
-                "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159",
-                "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"
+                "sha256:c500b592c5512df35622e4faf2135aa0b7e989c7d31344194b4afb9d5e47b1bf",
+                "sha256:d81d19a3a88d82ed06998353ce5d5c02587ef07ee2d808ae63904ab0ccef0087"
             ],
-            "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"
+            "markers": "python_version >= '3.7'",
+            "version": "==1.1.0"
         },
         "pytest": {
             "hashes": [
@@ -461,12 +453,28 @@
             "index": "pypi",
             "version": "==3.0.2"
         },
-        "snowballstemmer": {
+        "ruff": {
             "hashes": [
-                "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1",
-                "sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a"
+                "sha256:06b8ee4eb8711ab119db51028dd9f5384b44728c23586424fd6e241a5b9c4a3b",
+                "sha256:1609b864a8d7ee75a8c07578bdea0a7db75a144404e75ef3162e0042bfdc100d",
+                "sha256:19643d448f76b1eb8a764719072e9c885968971bfba872e14e7257e08bc2f2b7",
+                "sha256:273a01dc8c3c4fd4c2af7ea7a67c8d39bb09bce466e640dd170034da75d14cab",
+                "sha256:27b2ea68d2aa69fff1b20b67636b1e3e22a6a39e476c880da1282c3e4bf6ee5a",
+                "sha256:48eccf225615e106341a641f826b15224b8a4240b84269ead62f0afd6d7e2d95",
+                "sha256:677284430ac539bb23421a2b431b4ebc588097ef3ef918d0e0a8d8ed31fea216",
+                "sha256:691d72a00a99707a4e0b2846690961157aef7b17b6b884f6b4420a9f25cd39b5",
+                "sha256:86bc788245361a8148ff98667da938a01e1606b28a45e50ac977b09d3ad2c538",
+                "sha256:905ff8f3d6206ad56fcd70674453527b9011c8b0dc73ead27618426feff6908e",
+                "sha256:9c4bfb75456a8e1efe14c52fcefb89cfb8f2a0d31ed8d804b82c6cf2dc29c42c",
+                "sha256:a37ec80e238ead2969b746d7d1b6b0d31aa799498e9ba4281ab505b93e1f4b28",
+                "sha256:ae9b57546e118660175d45d264b87e9b4c19405c75b587b6e4d21e6a17bf4fdf",
+                "sha256:bd2bbe337a3f84958f796c77820d55ac2db1e6753f39d1d1baed44e07f13f96d",
+                "sha256:d5a208f8ef0e51d4746930589f54f9f92f84bb69a7d15b1de34ce80a7681bc00",
+                "sha256:dc406e5d756d932da95f3af082814d2467943631a587339ee65e5a4f4fbe83eb",
+                "sha256:ee76b4f05fcfff37bd6ac209d1370520d509ea70b5a637bdf0a04d0c99e13dff"
             ],
-            "version": "==2.2.0"
+            "index": "pypi",
+            "version": "==0.0.272"
         },
         "towncrier": {
             "hashes": [
diff --git a/newsfragments/382.misc.rst b/newsfragments/382.misc.rst
new file mode 100644
index 0000000..ab02f42
--- /dev/null
+++ b/newsfragments/382.misc.rst
@@ -0,0 +1,1 @@
+Replace pydocstyle and pycodestyle with ruff
\ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
index 756e2a6..223afa6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -7,6 +7,15 @@ line-length = 80
 target-version = ['py38']
 include = '.*\.pyi?$'
 
+[tool.ruff]
+line-length = 80
+select = [
+    "E",   # pycodestyle
+    "F",   # pyflakes
+    "I",   # isort
+    "D",   # pydocstyle
+]
+
 [tool.towncrier]
 directory = "newsfragments"
 single_file=true
diff --git a/requirements-lint.txt b/requirements-lint.txt
deleted file mode 100644
index f9fd41e..0000000
--- a/requirements-lint.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-# linters
-pycodestyle==2.10.0
-pydocstyle==6.1.1
-black==22.10.0
--r requirements-test.txt
diff --git a/setup.py b/setup.py
index 2fad259..d5b7a4a 100644
--- a/setup.py
+++ b/setup.py
@@ -19,5 +19,4 @@
 """Package definition for pytest-mongo."""
 from setuptools import setup
 
-
 setup()


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index fc59a0f..9362dc2 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -3,10 +3,6 @@ name: Run tests
 on:
   push:
     branches: [ main ]
-    paths:
-      - '**.py'
-      - .github/workflows/tests.yml
-      - requirements-test.txt
   pull_request:
     branches: [ main ]
 
diff --git a/pytest_mongo/executor_noop.py b/pytest_mongo/executor_noop.py
index 2b46aab..5774188 100644
--- a/pytest_mongo/executor_noop.py
+++ b/pytest_mongo/executor_noop.py
@@ -3,8 +3,7 @@
 
 
 class NoopExecutor:  # pylint: disable=too-few-public-methods
-    """
-    Nooperator executor.
+    """Nooperator executor.
 
     This executor actually does nothing more than provide connection details
     for existing MongoDB server. I.E. one already started either on machine
@@ -12,8 +11,7 @@ class NoopExecutor:  # pylint: disable=too-few-public-methods
     """
 
     def __init__(self, host, port):
-        """
-        Initialize nooperator executor mock.
+        """Initialize nooperator executor mock.
 
         :param str host: MongoDB hostname
         :param str|int port: MongoDB port
diff --git a/pytest_mongo/factories.py b/pytest_mongo/factories.py
index 302c65e..dc6eb2c 100644
--- a/pytest_mongo/factories.py
+++ b/pytest_mongo/factories.py
@@ -21,10 +21,10 @@
 from tempfile import gettempdir
 from typing import Callable, Union
 
-import pytest
 import pymongo
-from mirakuru import TCPExecutor
+import pytest
 from _pytest.fixtures import FixtureRequest
+from mirakuru import TCPExecutor
 from port_for import get_port
 
 from pytest_mongo.executor_noop import NoopExecutor
@@ -44,8 +44,7 @@ def get_config(request):
 
 
 def mongo_proc(executable=None, params=None, host=None, port=-1, logsdir=None):
-    """
-    Mongo process fixture factory.
+    """Mongo process fixture factory.
 
     .. note::
         `mongod <http://docs.mongodb.org/v2.2/reference/mongod/>`_
@@ -66,8 +65,7 @@ def mongo_proc(executable=None, params=None, host=None, port=-1, logsdir=None):
 
     @pytest.fixture(scope="session")
     def mongo_proc_fixture(request):
-        """
-        Mongodb process fixture.
+        """Mongodb process fixture.
 
         :param FixtureRequest request: fixture request object
         :rtype: mirakuru.TCPExecutor
@@ -112,8 +110,7 @@ def mongo_proc_fixture(request):
 def mongo_noproc(
     host: str = None, port: Union[str, int] = None
 ) -> Callable[[FixtureRequest], NoopExecutor]:
-    """
-    MongoDB noprocess factory.
+    """MongoDB noprocess factory.
 
     :param host: hostname
     :param port: exact port (e.g. '8000', 8000)
@@ -125,8 +122,7 @@ def mongo_noproc(
 
     @pytest.fixture(scope="session")
     def mongo_noproc_fixture(request: FixtureRequest) -> NoopExecutor:
-        """
-        Noop Process fixture for MongoDB.
+        """Noop Process fixture for MongoDB.
 
         :param FixtureRequest request: fixture request object
         :returns: tcp executor-like object
@@ -143,8 +139,7 @@ def mongo_noproc_fixture(request: FixtureRequest) -> NoopExecutor:
 
 
 def mongodb(process_fixture_name, tz_aware=None):
-    """
-    Mongo database factory.
+    """Mongo database factory.
 
     :param str process_fixture_name: name of the process fixture
     :param bool tz_aware: whether the client to be timezone aware or not
@@ -154,8 +149,7 @@ def mongodb(process_fixture_name, tz_aware=None):
 
     @pytest.fixture
     def mongodb_factory(request):
-        """
-        Client fixture for MongoDB.
+        """Client fixture for MongoDB.
 
         :param FixtureRequest request: fixture request object
         :rtype: pymongo.connection.Connection
diff --git a/requirements-test.txt b/requirements-test.txt
deleted file mode 100644
index 9e3456c..0000000
--- a/requirements-test.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-# test runs requirements (versions we'll be testing against) - automatically updated by requires.io
-pytest==7.2.0
-pytest-cov==4.0.0
-pytest-xdist==3.0.2
-coverage==6.5.0 # pytest-cov
-mirakuru==2.4.2
-port-for==0.6.2
-pymongo==4.3.3
--e .[tests]
diff --git a/tests/conftest.py b/tests/conftest.py
index 6a40f55..1810014 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,6 +1,6 @@
 """Tests main conftest file."""
-from pytest_mongo.plugin import *
 from pytest_mongo import factories
+from pytest_mongo.plugin import *  # noqa: F403
 
 # pylint:disable=invalid-name
 mongo_params = "--nojournal --noauth"
diff --git a/tests/test_noopexecutor.py b/tests/test_noopexecutor.py
index 8cdf70c..9ac9488 100644
--- a/tests/test_noopexecutor.py
+++ b/tests/test_noopexecutor.py
@@ -1,6 +1,7 @@
 """Test for NoopExecutor."""
 
 import pymongo
+
 from pytest_mongo.executor_noop import NoopExecutor