Skip to content

Commit 257c4c1

Browse files
committed
Run ruff and yapf in pre-commit
1 parent d3c3e86 commit 257c4c1

File tree

2 files changed

+39
-7
lines changed

2 files changed

+39
-7
lines changed

.github/workflows/main.yml

Lines changed: 13 additions & 7 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,17 @@ 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, Ruff, Yapf, Test]
52+
task: [Lint, Test]
4753
include:
48-
- task: Typecheck
49-
cmd: pytype -j auto .
54+
#- task: Typecheck
55+
# cmd: pytype -j auto .
5056
- task: Lint
5157
cmd: pylint --rcfile .pylintrc --recursive yes .
52-
- task: Ruff
53-
cmd: ruff check
54-
- task: Yapf
55-
cmd: yapf . -drp
58+
#- task: Ruff
59+
# cmd: ruff check
60+
#- task: Yapf
61+
# cmd: yapf . -drp
5662
- task: Test
5763
cmd: pytest
5864
steps:

.pre-commit-config.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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/google/pytype
11+
rev: 2024.10.11
12+
hooks:
13+
- id: pytype
14+
15+
- repo: https://github.com/astral-sh/ruff-pre-commit
16+
rev: v0.11.2
17+
hooks:
18+
- id: ruff
19+
# - id: ruff-format
20+
21+
# Run yapf in pre-commit
22+
- repo: https://github.com/google/yapf
23+
rev: v0.43.0
24+
hooks:
25+
- id: yapf
26+
args: [--in-place, --recursive, --parallel]

0 commit comments

Comments
 (0)