From e46f13930d570db7bd01d1798529b9662c9c83f0 Mon Sep 17 00:00:00 2001 From: Stefano Date: Wed, 28 May 2025 20:50:10 -0500 Subject: [PATCH] Added ruff linter and formatter --- .pre-commit-config.yaml | 7 +++++++ .vscode/settings.json | 8 ++++++++ pyproject.toml | 16 ++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 .pre-commit-config.yaml create mode 100644 pyproject.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..ed93f20 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,7 @@ +repos: +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.11.2 + hooks: + - id: ruff + args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 012dc88..01047c9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,8 @@ { + "editor.formatOnSave": true, + "editor.defaultFormatter": "charliermarsh.ruff", + "ruff.importStrategy": "fromEnvironment", + "ruff.path": ["${workspaceFolder}"], "cSpell.words": [ "addopts", "adminpassword", @@ -42,6 +46,7 @@ "fullchain", "gitea", "iptv", + "isort", "lclogo", "LETSENCRYPT", "nohup", @@ -51,10 +56,13 @@ "poolclass", "psycopg", "pycache", + "pycodestyle", + "pyflakes", "pyjwt", "pytest", "PYTHONDONTWRITEBYTECODE", "PYTHONUNBUFFERED", + "pyupgrade", "reloadcmd", "roomodes", "ruru", diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..a07ce25 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,16 @@ +[tool.ruff] +line-length = 88 +select = [ + "E", # pycodestyle errors + "F", # pyflakes + "I", # isort + "UP", # pyupgrade + "W", # pycodestyle warnings +] +ignore = [] + +[tool.ruff.isort] +known-first-party = ["app"] + +[tool.ruff.format] +docstring-code-format = true \ No newline at end of file