Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Add lint and isort configuration to pyproject.toml

Roland Geider81c57a0ad768
diff --git a/pyproject.toml b/pyproject.toml
index be5b0ccb3..9691f8087 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -47,7 +47,57 @@ dependencies = { file = ["requirements.txt"] }
[tool.distutils.bdist_wheel]
universal = 1
+
+[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",
+]
+line-length = 100
+indent-width = 4
+src = ["wger", "extras"]
+
+[tool.ruff.lint]
+select = [
+ "F", # Pyflakes
+ "E", # Pycodestyle
+ "W",
+]
+
+[tool.ruff.format]
+quote-style = "single"
+indent-style = "space"
+skip-magic-trailing-comma = false # Like Black, respect magic trailing commas.
+line-ending = "auto"
+
[tool.isort]
+src_paths = ["wger", "extras"]
+
sections = ["FUTURE", "STDLIB", "DJANGO", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
skip = ["extras", "build", "dist", "node_modules", "migrations", "docs", "settings.py", "apps.py"]
# If set to true - ensures that if a star import is present, nothing else is
@@ -82,7 +132,7 @@ known_django = ["django"]
# enough to span multiple lines. A full definition of all possible modes can be
# found in isort's README.
multi_line_output = 3
-force_grid_wrap = true
+force_grid_wrap = 2
# If set to true - isort will create separate sections within "from" imports
# for CONSTANTS, Classes, and modules/functions.
order_by_type = true
@@ -90,23 +140,15 @@ order_by_type = true
# of functional code. By default, this is 2 lines if the first line of code is a
# class or function. Otherwise, it's 1.
lines_after_imports = 2
+
# If set to true - isort will combine as imports on the same line within for
# import statements. By default, isort forces all as imports to display on their
# own lines.
combine_as_imports = true
+
# If set to true - isort will add imports even if the file specified is
# currently completely empty.
force_adds = false
# Include a trailing comma after the imports. This ensures that yapf doesn't
# reformat the code
include_trailing_comma = true
-
-[tool.yapf]
-based_on_style = "pep8"
-column_limit = "100"
-blank_line_before_nested_class_or_def = "True"
-dedent_closing_brackets = "True"
-split_penalty_import_names = "100"
-# # Too much...
-# split_all_comma_separated_values = True
-