Skip to content

Commit

Permalink
chore: migrate to ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
art049 committed Nov 24, 2022
1 parent 633c4e0 commit 0c248d2
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 24 deletions.
4 changes: 4 additions & 0 deletions .darglint
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[darglint]
# Allow one line docstrings without arg spec
strictness = short
docstring_style = google
11 changes: 0 additions & 11 deletions .flake8

This file was deleted.

17 changes: 11 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 0 additions & 4 deletions .pydocstyle

This file was deleted.

2 changes: 1 addition & 1 deletion odmantic/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
39 changes: 37 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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
Expand Down

0 comments on commit 0c248d2

Please sign in to comment.