diff --git a/.darglint b/.darglint new file mode 100644 index 00000000..ab115f72 --- /dev/null +++ b/.darglint @@ -0,0 +1,4 @@ +[darglint] +# Allow one line docstrings without arg spec +strictness = short +docstring_style = google diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 32866800..00000000 --- a/.flake8 +++ /dev/null @@ -1,11 +0,0 @@ -[flake8] -max-line-length = 88 -max-complexity = 10 -ignore = - E203, # See https://github.com/PyCQA/pycodestyle/issues/373 - W503 - -# darglint -# Allow one line docstrings without arg spec -strictness=short -docstring_style=google diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7c14f8ab..ef25daab 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,15 +38,20 @@ repos: - motor~=3.0.0 - types-pytz~=2022.1.1 args: [--no-pretty, --show-error-codes] - - repo: https://gitlab.com/pycqa/flake8.git - rev: "3.8.3" + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.0.137 hooks: - - id: flake8 + - id: ruff exclude: "^docs/.*|.github/release.py" - additional_dependencies: - - darglint~=1.8.1 + - repo: https://github.com/pycqa/pydocstyle - rev: 5.1.1 # pick a git hash / tag to point to + rev: 6.1.1 # pick a git hash / tag to point to hooks: - id: pydocstyle files: "^odmantic/" + additional_dependencies: + - toml + - repo: https://github.com/terrencepreilly/darglint + rev: v1.8.1 + hooks: + - id: darglint diff --git a/.pydocstyle b/.pydocstyle deleted file mode 100644 index c1cae87a..00000000 --- a/.pydocstyle +++ /dev/null @@ -1,4 +0,0 @@ -[pydocstyle] -convention=google -match_dir=odmantic -add_ignore=D1,D415,D205 diff --git a/odmantic/config.py b/odmantic/config.py index ba5bddb4..7cf56574 100644 --- a/odmantic/config.py +++ b/odmantic/config.py @@ -20,7 +20,7 @@ # pydantic<1.9.0 # Cannot use type: ignore for all versions # -> https://github.com/python/mypy/issues/8823 - from pydantic.main import SchemaExtraCallable # type: ignore + from pydantic.main import SchemaExtraCallable # type: ignore # noqa: F401 class BaseODMConfig: diff --git a/pyproject.toml b/pyproject.toml index 424b3a3e..ded92e24 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ fastapi = ["fastapi >=0.61.1"] test = [ "black ~= 22.3.0", "isort ~=5.8.0", - "flake8 ~= 4.0.1", + "ruff ~= 0.0.137", "mypy ~= 0.961", "pytest ~= 7.0", "pytest-xdist ~= 2.1.0", @@ -66,7 +66,7 @@ test = [ "types-pytz ~= 2022.1.1", ] doc = [ - "pydocstyle ~= 6.0.0", + "pydocstyle[toml] ~= 6.1.1", "mkdocs-material ~= 8.4.0", "mkdocstrings[python] ~= 0.19.0", "mkdocs-macros-plugin ~= 0.5.0", @@ -81,6 +81,41 @@ Source = "https://github.com/art049/odmantic" requires = ["flit_core >=3.2,<4"] build-backend = "flit_core.buildapi" +[tool.ruff] +per-file-ignores = { "tests/*" = ["C", "I"], "odmantic/typing.py" = ["I001"] } +line-length = 88 +select = ["E", "F", "I", "C"] +ignore = ["C405"] +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".hg", + ".mypy_cache", + ".nox", + ".pants.d", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "venv", +] + +[tool.ruff.mccabe] +max-complexity = 10 + +[tool.pydocstyle] +convention = "google" +match_dir = "odmantic" +add_ignore = ["D1", "D205", "D415"] + [tool.isort] line_length = 88 multi_line_output = 3