diff --git a/.gitea/workflows/pre-commit.yml b/.gitea/workflows/pre-commit.yml new file mode 100644 index 0000000000..0237934358 --- /dev/null +++ b/.gitea/workflows/pre-commit.yml @@ -0,0 +1,12 @@ +--- +name: pre-commit +on: + - push + - pull_request +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..fd58227677 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,15 @@ +--- +repos: + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.6.1 + hooks: + - id: ruff + args: + - --output-format=full + exclude: ^source/tools/webservices/ + - id: ruff-format + args: + - --check + - --target-version + - py311 + exclude: ^source/tools/webservices/ diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000000..4ca9e6080d --- /dev/null +++ b/ruff.toml @@ -0,0 +1,10 @@ +line-length = 99 + +[lint.isort] +lines-after-imports = 2 + +[lint.pycodestyle] +max-doc-length = 72 + +[lint.pydocstyle] +convention = "pep257"