Skip to content

Commit 5c75fc5

Browse files
committed
Use pre-commit in CI context
Signed-off-by: Stephen Finucane <[email protected]>
1 parent 0764da5 commit 5c75fc5

File tree

1 file changed

+15
-44
lines changed

1 file changed

+15
-44
lines changed

.github/workflows/lint.yml

Lines changed: 15 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,9 @@ jobs:
2222
uses: actions/setup-python@v4
2323
with:
2424
python-version: 3
25-
- name: Install pip
26-
run: python -m pip install --upgrade pip
27-
28-
- name: Install known good Ruff
29-
run: python -m pip install ruff==0.0.284
30-
- name: Lint with known good Ruff
31-
run: ruff . --diff --format github
32-
33-
- name: Install latest Ruff
34-
run: python -m pip install --upgrade ruff
35-
- name: Lint with Ruff
36-
continue-on-error: true
37-
run: ruff . --diff --format github
25+
- uses: pre-commit/[email protected]
26+
with:
27+
extra_args: ruff --all-files
3828

3929
flake8:
4030
runs-on: ubuntu-latest
@@ -45,12 +35,9 @@ jobs:
4535
uses: actions/setup-python@v4
4636
with:
4737
python-version: 3
48-
- name: Install dependencies
49-
run: |
50-
python -m pip install --upgrade pip
51-
python -m pip install --upgrade "flake8>=3.5.0" "flake8-simplify"
52-
- name: Lint with flake8
53-
run: flake8 .
38+
- uses: pre-commit/[email protected]
39+
with:
40+
extra_args: flake8 --all-files
5441

5542
isort:
5643
runs-on: ubuntu-latest
@@ -61,12 +48,9 @@ jobs:
6148
uses: actions/setup-python@v4
6249
with:
6350
python-version: 3
64-
- name: Install dependencies
65-
run: |
66-
python -m pip install --upgrade pip
67-
python -m pip install --upgrade isort
68-
- name: Lint with isort
69-
run: isort --check-only --diff .
51+
- uses: pre-commit/[email protected]
52+
with:
53+
extra_args: isort --all-files
7054

7155
mypy:
7256
runs-on: ubuntu-latest
@@ -77,12 +61,9 @@ jobs:
7761
uses: actions/setup-python@v4
7862
with:
7963
python-version: 3
80-
- name: Install dependencies
81-
run: |
82-
python -m pip install --upgrade pip
83-
python -m pip install --upgrade "mypy>=0.990" docutils-stubs types-requests
84-
- name: Type check with mypy
85-
run: mypy sphinx/
64+
- uses: pre-commit/[email protected]
65+
with:
66+
extra_args: mypy --all-files
8667

8768
docs-lint:
8869
runs-on: ubuntu-latest
@@ -93,19 +74,9 @@ jobs:
9374
uses: actions/setup-python@v4
9475
with:
9576
python-version: 3
96-
- name: Install dependencies
97-
run: |
98-
python -m pip install --upgrade pip
99-
python -m pip install --upgrade sphinx-lint
100-
- name: Lint documentation with sphinx-lint
101-
run: >
102-
sphinx-lint
103-
--enable line-too-long
104-
--max-line-length 85
105-
CHANGES
106-
CONTRIBUTING.rst
107-
README.rst
108-
doc/
77+
- uses: pre-commit/[email protected]
78+
with:
79+
extra_args: sphinx-lint --all-files
10980

11081
twine:
11182
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)