diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index d7476671d..a85c6f5f2 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -1,4 +1,4 @@ -name: CI +name: Ruff on: push: @@ -15,16 +15,11 @@ jobs: ruff: name: ruff runs-on: ubuntu-latest + steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - cache: 'pip' - - run: | - python -m pip install --upgrade pip - pip install ruff - - name: Run Ruff - run: ruff . + - uses: actions/checkout@v4 + + - run: python -Im pip install --user ruff + + - name: Run Ruff + run: ruff --output-format=github . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d2a48133a..3adb880bd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,6 +7,9 @@ ci: autoupdate_commit_msg: 'ci: pre-commit autoupdate' autoupdate_schedule: monthly +default_language_version: + python: python3.10 + fail_fast: true repos: @@ -20,29 +23,9 @@ repos: hooks: - id: pyupgrade args: ["--py310-plus"] - - repo: https://github.com/PyCQA/autoflake - rev: v2.2.1 - hooks: - - id: autoflake - entry: bash -c 'autoflake "$@"; git add -u;' -- - language: python - args: - [ - "--in-place", - "--remove-all-unused-imports", - "--remove-unused-variables", - "--expand-star-imports", - "--ignore-init-module-imports", - ] - files: \.py$ - - repo: https://github.com/psf/black - rev: 23.12.1 - hooks: - - id: black - entry: bash -c 'black "$@"; git add -u;' -- - language_version: python3.10 - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.1.9" + rev: v0.1.15 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format diff --git a/pyproject.toml b/pyproject.toml index 24fbb6bcd..fec269296 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,3 @@ -[tool.black] -line-length = 120 -target-version = ["py310"] - [tool.ruff] # https://beta.ruff.rs/docs/configuration/ line-length = 120 @@ -29,19 +25,20 @@ select = [ "RUF" ] -exclude = [ +extend-exclude = [ ".eggs", ".git", ".mypy_cache", ".ruff_cache", ".env", ".venv", + "**locale/**", "**migrations/**", "node_modules", "venv", ] -ignore = [ +extend-ignore = [ "B006", # Do not use mutable data structures for argument defaults "B011", # tests use assert False "B019", # Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks @@ -87,3 +84,9 @@ known-first-party = [ "story", ] extra-standard-library = ["dataclasses"] + +[tool.ruff.format] +quote-style = "double" +indent-style = "space" +docstring-code-format = true +docstring-code-line-length = 80 \ No newline at end of file