From ab0e6848a51c748fee9f612eb42a6056e1916e94 Mon Sep 17 00:00:00 2001 From: Martin Hammarstedt Date: Mon, 22 Jan 2024 17:28:48 +0100 Subject: [PATCH] Add Ruff config --- pyproject.toml | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index b7ad0fed..961b936d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,7 @@ dev = [ "pandocfilters==1.5.0", "pytest>=6.0.0", "pytest-sugar>=0.9.6", + "ruff" ] [project.urls] @@ -56,6 +57,57 @@ publish.index.disable = true # Require confirmation to publish [tool.black] line-length = 120 +[tool.ruff] +line-length = 120 + +[tool.ruff.lint] +select = [ + "A", # flake8-builtins + "ANN", # flake8-annotations + "ARG", # flake8-unused-arguments + "B", # flake8-bugbear + "C4", # flake8-comprehensions + "COM", # flake8-commas + "D", # pydocstyle + "D400", # pydocstyle: ends-in-period + "D401", # pydocstyle: non-imperative-mood + "E", # pycodestyle: errors + "F", # Pyflakes + "FLY", # flynt + "FURB", # refurb + "G", # flake8-logging-format + "I", # isort + "ISC", # flake8-implicit-str-concat + "N", # pep8-naming + "PERF", # Perflint + "PL", # Pylint + "PT", # flake8-pytest-style + "PTH", # flake8-use-pathlib + "Q", # flake8-quotes + "RET", # flake8-return + "RSE", # flake8-raise + "RUF", # Ruff-specific rules + "SIM", # flake8-simplify + "T20", # flake8-print + "TID", # flake8-tidy-imports + "UP", # pyupgrade + "W", # pycodestyle: warnings +] +ignore = [ + "ANN101", # flake8-annotations: missing-type-self + "ANN102", # flake8-annotations: missing-type-cls + "B008", # flake8-bugbear: function-call-in-default-argument + "COM812", # flake8-commas: missing-trailing-comma + "PLR09", # Pylint: too-many-* + "SIM105", # flake8-simplify: suppressible-exception +] + +[tool.ruff.per-file-ignores] +"__init__.py" = ["F401"] + +[tool.ruff.lint.pydocstyle] +convention = "google" + [tool.pytest.ini_options] addopts = "-s -v --tb=no" testpaths = ["tests"]