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

Issue:
replace pydocstyle and pycodestyle with ruff



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml
index 17b3c252..f2283ddd 100644
--- a/.github/workflows/linters.yml
+++ b/.github/workflows/linters.yml
@@ -13,5 +13,4 @@ jobs:
       pipenv-install-options: "--skip-lock"
       mypy: true
       black: true
-      pycodestyle: true
-      pydocstyle: true
+      ruff: true
diff --git a/Pipfile b/Pipfile
index 7568215d..c4e77ca8 100644
--- a/Pipfile
+++ b/Pipfile
@@ -14,8 +14,7 @@ boto3-stubs = {version = "==1.26.146", extras = ["dynamodb"]}
 towncrier = "==22.12"
 pytest-cov = "==4.1.0"
 pytest-xdist = "==3.3.1"
-pycodestyle = "==2.10.0"
-pydocstyle = {version = "==6.3.0", extras = ["toml"]}
 black = "==23.3.0"
 mypy = "==1.3.0"
 tbump = "==6.10.0"
+ruff = "==0.0.271"
diff --git a/Pipfile.lock b/Pipfile.lock
index 5c1f8381..5cefab64 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,7 +1,7 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "5f0616f5a87e08f5d7fa7edeead988bd40cb90ecba0ec56f01d1e36d5bcdf3fb"
+            "sha256": "ec9f90d82885d74be5fcfa7f30cfd2834d40b39aa94b628142663e0ce4246a5d"
         },
         "pipfile-spec": 6,
         "requires": {},
@@ -35,19 +35,19 @@
         },
         "botocore": {
             "hashes": [
-                "sha256:77f7793cb36074eb84d606a23ad6e1d57c20f7a2eeab7d9136d3e63c584e0504",
-                "sha256:ac57003292f18206ee942eafc381ecd9a3420a3844d6b7e1c1b0f4b88b28263b"
+                "sha256:36bccc4e094faf1bfbda2241eb1c71e72a63f3c12b2adfc4c3cbd02349bc416b",
+                "sha256:71c512fbd42e0ef171388b53bf82f9cb9e66283467156917b69717daeb05eba6"
             ],
             "markers": "python_version >= '3.7'",
-            "version": "==1.29.146"
+            "version": "==1.29.148"
         },
         "botocore-stubs": {
             "hashes": [
-                "sha256:183abbfbd5e98a370f6041277200f285cd274dd8316f6a53504686b6795778b1",
-                "sha256:ec63495644bcfffd905986fc2cf875671b425eb5b8b87f9f86a509d64f463af4"
+                "sha256:6b537fb1a65f02a4806d7ec917c89187a493d8f0050c8944c6ae7bd07def7b3f",
+                "sha256:96cb761478bf428efc779d09deef5f7c3a71c0aeda2154f52acee3269c4b848f"
             ],
             "markers": "python_version >= '3.7' and python_version < '4.0'",
-            "version": "==1.29.146"
+            "version": "==1.29.148"
         },
         "iniconfig": {
             "hashes": [
@@ -485,25 +485,6 @@
             "markers": "python_version >= '3.6'",
             "version": "==1.0.0"
         },
-        "pycodestyle": {
-            "hashes": [
-                "sha256:347187bdb476329d98f695c213d7295a846d1152ff4fe9bacb8a9590b8ee7053",
-                "sha256:8a4eaf0d0495c7395bdab3589ac2db602797d76207242c17d470186815706610"
-            ],
-            "index": "pypi",
-            "version": "==2.10.0"
-        },
-        "pydocstyle": {
-            "extras": [
-                "toml"
-            ],
-            "hashes": [
-                "sha256:118762d452a49d6b05e194ef344a55822987a462831ade91ec5c06fd2169d019",
-                "sha256:7ce43f0c0ac87b07494eb9c0b462c0b73e6ff276807f204d6b53edc72b7e44e1"
-            ],
-            "index": "pypi",
-            "version": "==6.3.0"
-        },
         "pytest": {
             "hashes": [
                 "sha256:3799fa815351fea3a5e96ac7e503a96fa51cc9942c3753cda7651b93c1cfa362",
@@ -528,6 +509,29 @@
             "index": "pypi",
             "version": "==3.3.1"
         },
+        "ruff": {
+            "hashes": [
+                "sha256:140e912a18a662062b04b489861e5aebdbe1a1668bf416e5a951f2347aa65907",
+                "sha256:191cdddfc82165afd63ab29ad671419a90a5e699b026ac2d9c61232543965de6",
+                "sha256:1a627978df924635f7d1a169a98abb2ea488c2d409da56a3f9e44a82d30606ac",
+                "sha256:403e8f9de18b2279d65015a45e0e0d98d60ad878d52f46904f502a4d09465815",
+                "sha256:45b3c3551a798d9786779c6dd7ad2224af6e06162e17f4a0e7678d3e9115ae56",
+                "sha256:5a73ffda5548ea8e28e0afcfa698a8675bb17f7048299327f4c1a1287b6e36a2",
+                "sha256:67525aa821ff0f8371eaa28c73dc467b8eea18931a8bd749775ad538fe1f35e6",
+                "sha256:7543b8a32e000ed30727ca6e570a90ab26f8899ee23dffb28806dfc2618782fb",
+                "sha256:7e34ca86329a542ab5d31f4fc2702f556d62748f4217e2f6951aef93176190f0",
+                "sha256:9e5de841e09ea75a26956a2cda930d1260c9d8d94cbe57c13b3e881d96526860",
+                "sha256:be4590137a31c47e7f6ef4488d60102c68102f842453355d8073193a30199aa7",
+                "sha256:cd43c1aff3eefb2193a125a12124438f65a8d1a6da0e86f8545141d48f6a39fa",
+                "sha256:efdfe7fea656eb2ed54f123135c04f71744ad6e4c0c6be156d46e7a2f4730d48",
+                "sha256:f3fd9e7c7afb7740d2734af3348e6c88226b42acba2e10a3d1e449caa67e4652",
+                "sha256:f445c56cdc8c12fc28a0b16588ba33abebb6340cb5b1b5a7d5668d4c0b31ad33",
+                "sha256:f47d8a192f6869e95896dc5bb7e825a4f9c554136b9c3bddd38389e43d4db08b",
+                "sha256:fca503741f4b23a7179fd7a9bc50fc2cca637e9a4da027776f38690c50ae559f"
+            ],
+            "index": "pypi",
+            "version": "==0.0.271"
+        },
         "schema": {
             "hashes": [
                 "sha256:f06717112c61895cabc4707752b88716e8420a8819d71404501e114f91043197",
@@ -543,13 +547,6 @@
             "markers": "python_version >= '3.7'",
             "version": "==67.8.0"
         },
-        "snowballstemmer": {
-            "hashes": [
-                "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1",
-                "sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a"
-            ],
-            "version": "==2.2.0"
-        },
         "tabulate": {
             "hashes": [
                 "sha256:0ba055423dbaa164b9e456abe7920c5e8ed33fcc16f6d1b2f2d152c8e1e8b4fc",
diff --git a/newsfragments/1178.misc.rst b/newsfragments/1178.misc.rst
new file mode 100644
index 00000000..51c5590d
--- /dev/null
+++ b/newsfragments/1178.misc.rst
@@ -0,0 +1,1 @@
+Replace pycodestyle and pydocstyle linters with ruff.
diff --git a/pyproject.toml b/pyproject.toml
index 8166fde2..a367d6d9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -64,6 +64,16 @@ line-length = 80
 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
@@ -86,9 +96,6 @@ showcontent = true
 name = "Miscellaneus"
 showcontent = true
 
-[tool.pydocstyle]
-ignore = "D203,D212"
-
 [tool.tbump]
 # Uncomment this if your project is hosted on GitHub:
 # github_url = "https://github.com/ClearcodeHQ/pytest-dynamodb/"
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 2627357a..00000000
--- a/setup.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
-[pycodestyle]
-max-line-length = 80
-exclude = docs/*,build/*,venv/*


Test patch:
diff --git a/pytest_dynamodb/factories.py b/pytest_dynamodb/factories.py
index e64c6f5b..70f68b5a 100644
--- a/pytest_dynamodb/factories.py
+++ b/pytest_dynamodb/factories.py
@@ -18,14 +18,14 @@
 """Module containing factories for pytest-dynamodb."""
 import os
 from pathlib import Path
-from typing import TypedDict, Optional, Any, Callable, Generator
+from typing import Any, Callable, Generator, Optional, TypedDict
 
-import pytest
 import boto3
+import pytest
+from mirakuru import ProcessExitedWithError, TCPExecutor
 from mypy_boto3_dynamodb import DynamoDBServiceResource
-from pytest import FixtureRequest
-from mirakuru import TCPExecutor, ProcessExitedWithError
 from port_for import get_port
+from pytest import FixtureRequest
 
 
 class PytestDynamoDBConfigType(TypedDict):
@@ -41,8 +41,7 @@ class PytestDynamoDBConfigType(TypedDict):
 
 
 class JarPathException(Exception):
-    """
-    Exception thrown, i ncase we can't locate dynamodb's dir to run dynamodb.
+    """Exception thrown, i ncase we can't locate dynamodb's dir to run dynamodb.
 
     We do not know where user has dynamodb jar file.
     So, we want to tell him that he has to provide a path to dynamodb dir.
@@ -76,8 +75,7 @@ def dynamodb_proc(
     port: Optional[int] = None,
     delay: bool = False,
 ) -> Callable[[FixtureRequest], Any]:
-    """
-    Process fixture factory for DynamoDB.
+    """Process fixture factory for DynamoDB.
 
     :param str dynamodb_dir: a path to dynamodb dir (without spaces)
     :param str host: hostname
@@ -96,8 +94,7 @@ def dynamodb_proc(
     def dynamodb_proc_fixture(
         request: FixtureRequest,
     ) -> Generator[TCPExecutor, None, None]:
-        """
-        Process fixture for DynamoDB.
+        """Process fixture for DynamoDB.
 
         It starts DynamoDB when first used and stops it at the end
         of the tests. Works on ``DynamoDBLocal.jar``.
@@ -147,8 +144,7 @@ def dynamodb(
     secret_key: Optional[str] = None,
     region: Optional[str] = None,
 ) -> Callable[[FixtureRequest], Any]:
-    """
-    Fixture factory for DynamoDB resource.
+    """Fixture factory for DynamoDB resource.
 
     :param str process_fixture_name: name of the process fixture
     :param str access_key: AWS acccess key
@@ -162,8 +158,7 @@ def dynamodb(
     def dynamodb_factory(
         request: FixtureRequest,
     ) -> Generator[DynamoDBServiceResource, None, None]:
-        """
-        Fixture for DynamoDB resource.
+        """Fixture for DynamoDB resource.
 
         :param FixtureRequest request: fixture request object
         :rtype: Subclass of :py:class:`~boto3.resources.base.ServiceResource`
diff --git a/pytest_dynamodb/plugin.py b/pytest_dynamodb/plugin.py
index 8e682538..746f93e3 100644
--- a/pytest_dynamodb/plugin.py
+++ b/pytest_dynamodb/plugin.py
@@ -20,7 +20,6 @@
 
 from pytest_dynamodb import factories
 
-
 # pylint:disable=invalid-name
 _help_dir = "Path to DynamoDB installation path"
 _help_host = "Host at which DynamoDB will accept connections"
diff --git a/tests/conftest.py b/tests/conftest.py
index 339fe72b..7c99b555 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,6 +1,6 @@
 """Tests main conftest file."""
-from pytest_dynamodb.plugin import *
 from pytest_dynamodb import factories
+from pytest_dynamodb.plugin import *  # noqa: F403
 
 # pylint:disable=invalid-name
 dynamodb_same = factories.dynamodb("dynamodb_proc")
diff --git a/tests/test_dynamodb.py b/tests/test_dynamodb.py
index b4403eb3..f7cd0b81 100644
--- a/tests/test_dynamodb.py
+++ b/tests/test_dynamodb.py
@@ -7,8 +7,7 @@
 
 
 def test_dynamodb(dynamodb: DynamoDBServiceResource) -> None:
-    """
-    Simple test for DynamoDB.
+    """Simple test for DynamoDB.
 
     # Create a table
     # Put an item
@@ -44,8 +43,7 @@ def test_dynamodb(dynamodb: DynamoDBServiceResource) -> None:
 
 
 def test_if_tables_does_not_exist(dynamodb: DynamoDBServiceResource) -> None:
-    """
-    We should clear this fixture (remove all tables).
+    """We should clear this fixture (remove all tables).
 
     .. note::
         `all` method on tables object creates an iterable of all
@@ -59,8 +57,7 @@ def test_different_credentials(
     dynamodb_same: DynamoDBServiceResource,
     dynamodb: DynamoDBServiceResource,
 ) -> None:
-    """
-    Check error when accessing table with different credentials.
+    """Check error when accessing table with different credentials.
 
     scan on dynamodb_diff should result in an error,
     while scans on dynamodb and dynamodb_same should pass.