summary refs log tree commit diff
path: root/.github/workflows/fix_lint.yaml
blob: f1e35fcd99d952c2e67a7d6f55f83f4469fa15fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# A helper workflow to automatically fixup any linting errors on a PR. Must be
# triggered manually.

name: Attempt to automatically fix linting errors

on:
  workflow_dispatch:

jobs:
  fixup:
    name: Fix up
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@master
        with:
          # We use nightly so that `fmt` correctly groups together imports, and
          # clippy correctly fixes up the benchmarks.
          toolchain: nightly-2022-12-01
          components: rustfmt
      - uses: Swatinem/rust-cache@v2

      - name: Setup Poetry
        uses: matrix-org/setup-python-poetry@v1
        with:
          install-project: "false"

      - name: Import order (isort)
        continue-on-error: true
        run: poetry run isort .

      - name: Code style (black)
        continue-on-error: true
        run: poetry run black .

      - name: Semantic checks (ruff)
        continue-on-error: true
        run: poetry run ruff --fix .

      - run: cargo clippy --all-features --fix -- -D warnings
        continue-on-error: true

      - run: cargo fmt
        continue-on-error: true

      - uses: stefanzweifel/git-auto-commit-action@v5
        with:
            commit_message: "Attempt to fix linting"