Skip to content

Commit 78aa8be

Browse files
committed
Run ruff and yapf in pre-commit
1 parent d3c3e86 commit 78aa8be

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v4
2020
- run: ./check-license.sh
21+
PreCommit:
22+
runs-on: ubuntu-22.04
23+
steps:
24+
- uses: actions/checkout@v4
25+
- run: pipx run pre-commit run --all-files
2126
Envvars:
2227
runs-on: ubuntu-22.04
2328
outputs:
@@ -43,16 +48,12 @@ jobs:
4348
strategy:
4449
matrix:
4550
python-version: ${{ fromJSON(needs.Envvars.outputs.version_matrix) }}
46-
task: [Typecheck, Lint, Ruff, Yapf, Test]
51+
task: [Typecheck, Lint, Test]
4752
include:
4853
- task: Typecheck
4954
cmd: pytype -j auto .
5055
- task: Lint
5156
cmd: pylint --rcfile .pylintrc --recursive yes .
52-
- task: Ruff
53-
cmd: ruff check
54-
- task: Yapf
55-
cmd: yapf . -drp
5657
- task: Test
5758
cmd: pytest
5859
steps:

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Learn more about this config here: https://pre-commit.com
2+
3+
# To enable these pre-commit hooks:
4+
# 1. Install pre-commit: `pip install pre-commit`
5+
# or if you are using pipx: `pipx install pre-commit`
6+
# or if you are using uv: `uv tool install pre-commit`.
7+
# Then in the project root directory run `pre-commit install`
8+
9+
repos:
10+
- repo: https://github.com/astral-sh/ruff-pre-commit
11+
rev: v0.11.2
12+
hooks:
13+
- id: ruff
14+
15+
- repo: https://github.com/google/yapf
16+
rev: v0.43.0
17+
hooks:
18+
- id: yapf
19+
args: [--in-place, --recursive, --parallel]

0 commit comments

Comments
 (0)