From b73cddab5388ab98a1f120caa5b7cbc0bd05eda1 Mon Sep 17 00:00:00 2001 From: imcompiling Date: Sat, 5 Oct 2024 11:52:28 -0400 Subject: [PATCH] Add ruff to project. --- pyproject.toml | 110 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 267a8d9..60e9413 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,6 +15,116 @@ pymysql = ">=1.0.2" cryptography = ">=2.8" +[tool.poetry.group.dev.dependencies] +ruff = "^0.6.9" + [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" + +[tool.ruff] +# Exclude a variety of commonly ignored directories. +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", + "dakiny-messages", # Don't need to lint this git repo. +] + +# Same as Black. +line-length = 120 +indent-width = 4 + +# Assume Python 3.8 +target-version = "py312" + +[tool.ruff.lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = ["ALL"] +ignore = [ + "ANN101", + "B008", # I build SlashOptions as arguments. + "COM812", + "COM819", + "D107", # don't want docstrings on init functions + "D203", + "D206", + "D212", + "D300", + "E111", + "E114", + "E117", + "ISC001", + "ISC002", + "PD011", # doesn't like me using '.values' on embeds.... + "Q000", + "Q001", + "Q002", + "Q003", + "W191", +] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[tool.ruff.lint.pydocstyle] +convention = "google" + +[tool.ruff.lint.flake8-annotations] +mypy-init-return = true + +[tool.ruff.format] +# Like Black, use double quotes for strings. +quote-style = "double" + +# Like Black, indent with spaces, rather than tabs. +indent-style = "space" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" + +# Enable auto-formatting of code examples in docstrings. Markdown, +# reStructuredText code/literal blocks and doctests are all supported. +# +# This is currently disabled by default, but it is planned for this +# to be opt-out in the future. +docstring-code-format = true + +# Set the line length limit used when formatting code snippets in +# docstrings. +# +# This only has an effect when the `docstring-code-format` setting is +# enabled. +docstring-code-line-length = "dynamic"