From fdabfa8e1ad2a788f0b2979dfa52953d83338901 Mon Sep 17 00:00:00 2001 From: Rob van der Linde Date: Thu, 7 Mar 2024 09:27:58 +1300 Subject: [PATCH] lint: add ruff and github action for linting --- .github/workflows/ci.yml | 15 +++++++++++++++ pyproject.toml | 33 +++++++++++++++++++++++++++++++++ src/sambal/forms/__init__.py | 4 ++++ src/sambal/tweens/__init__.py | 4 ++++ 4 files changed, 56 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9e1ee8b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,15 @@ +name: CI + +on: [ push, pull_request ] + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run Ruff over code + uses: chartboost/ruff-action@v1 diff --git a/pyproject.toml b/pyproject.toml index af858fa..07bc51d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,7 @@ test = [ "pytest==8.0.2", "pytest-cov==4.1.0", "WebTest==3.0.0", + "ruff==0.3.0", ] [project.license] @@ -64,3 +65,35 @@ universal = true [tool.pytest.ini_options] python_files = ["tests.py", "test_*.py", "*_tests.py"] addopts = "--cov=sambal --cov-branch --cov-report=term --cov-report=html:reports/htmlcov --cov-report=xml:reports/coverage.xml --junitxml=reports/junit.xml" + +[tool.ruff] +exclude = [ + ".coverage", + ".eggs", + ".git", + ".git-rewrite", + ".ruff_cache", + ".tox", + ".vscode", + "build", + "dist", + "venv", +] +line-length = 88 +indent-width = 4 +target-version = "py38" + +[tool.ruff.lint] +select = ["E4", "E7", "E9", "F"] +ignore = [] +fixable = ["ALL"] +unfixable = [] +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[tool.ruff.format] +quote-style = "double" +indent-style = "space" +skip-magic-trailing-comma = false +line-ending = "auto" +docstring-code-format = false +docstring-code-line-length = "dynamic" diff --git a/src/sambal/forms/__init__.py b/src/sambal/forms/__init__.py index 0a88cb2..3d238fc 100644 --- a/src/sambal/forms/__init__.py +++ b/src/sambal/forms/__init__.py @@ -1 +1,5 @@ from .login import LoginForm + +__all__ = ( + "LoginForm", +) diff --git a/src/sambal/tweens/__init__.py b/src/sambal/tweens/__init__.py index c4a8998..18453ef 100644 --- a/src/sambal/tweens/__init__.py +++ b/src/sambal/tweens/__init__.py @@ -1 +1,5 @@ from .headers import SecurityHeaders + +__all__ = ( + "SecurityHeaders", +)