Skip to content

Commit b9f0a92

Browse files
committed
Use pre-commit in CI context
Signed-off-by: Stephen Finucane <[email protected]>
1 parent 8ceb28d commit b9f0a92

File tree

1 file changed

+15
-46
lines changed

1 file changed

+15
-46
lines changed

.github/workflows/lint.yml

Lines changed: 15 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,9 @@ jobs:
2525
uses: actions/setup-python@v4
2626
with:
2727
python-version: "3"
28-
- name: Install pip
29-
run: python -m pip install --upgrade pip
30-
31-
- name: Install known good Ruff
32-
run: python -m pip install ruff==0.0.284
33-
- name: Lint with known good Ruff
34-
run: ruff . --format github
35-
36-
- name: Install latest Ruff
37-
run: python -m pip install --upgrade ruff
38-
- name: Lint with latest Ruff
39-
continue-on-error: true
40-
run: ruff . --format github
28+
- uses: pre-commit/[email protected]
29+
with:
30+
extra_args: ruff --all-files
4131

4232
flake8:
4333
runs-on: ubuntu-latest
@@ -48,12 +38,9 @@ jobs:
4838
uses: actions/setup-python@v4
4939
with:
5040
python-version: "3"
51-
- name: Install dependencies
52-
run: |
53-
python -m pip install --upgrade pip
54-
python -m pip install --upgrade "flake8>=3.5.0" "flake8-simplify"
55-
- name: Lint with flake8
56-
run: flake8 .
41+
- uses: pre-commit/[email protected]
42+
with:
43+
extra_args: flake8 --all-files
5744

5845
isort:
5946
runs-on: ubuntu-latest
@@ -64,12 +51,9 @@ jobs:
6451
uses: actions/setup-python@v4
6552
with:
6653
python-version: "3"
67-
- name: Install dependencies
68-
run: |
69-
python -m pip install --upgrade pip
70-
python -m pip install --upgrade isort
71-
- name: Lint with isort
72-
run: isort --check-only --diff .
54+
- uses: pre-commit/[email protected]
55+
with:
56+
extra_args: isort --all-files
7357

7458
mypy:
7559
runs-on: ubuntu-latest
@@ -80,12 +64,9 @@ jobs:
8064
uses: actions/setup-python@v4
8165
with:
8266
python-version: "3"
83-
- name: Install dependencies
84-
run: |
85-
python -m pip install --upgrade pip
86-
python -m pip install --upgrade "mypy>=0.990" docutils-stubs types-requests
87-
- name: Type check with mypy
88-
run: mypy sphinx/
67+
- uses: pre-commit/[email protected]
68+
with:
69+
extra_args: mypy --all-files
8970

9071
docs-lint:
9172
runs-on: ubuntu-latest
@@ -96,21 +77,9 @@ jobs:
9677
uses: actions/setup-python@v4
9778
with:
9879
python-version: "3"
99-
- name: Install dependencies
100-
run: |
101-
python -m pip install --upgrade pip
102-
python -m pip install --upgrade sphinx-lint
103-
- name: Lint documentation with sphinx-lint
104-
run: >
105-
sphinx-lint
106-
--enable line-too-long
107-
--max-line-length 85
108-
AUTHORS.rst
109-
CHANGES.rst
110-
CODE_OF_CONDUCT.rst
111-
CONTRIBUTING.rst
112-
README.rst
113-
doc/
80+
- uses: pre-commit/[email protected]
81+
with:
82+
extra_args: sphinx-lint --all-files
11483

11584
twine:
11685
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)