Skip to content

Commit f23e78f

Browse files
committed
Integrate Ruff code formatter
1 parent 887d270 commit f23e78f

File tree

6 files changed

+72
-0
lines changed

6 files changed

+72
-0
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,34 @@ jobs:
195195
release_skip_job: ${{ steps.set_ouputs.outputs.release_skip_job }}
196196
# }}}
197197

198+
# Job: Code Quality {{{
199+
code_quality:
200+
201+
name: Code Quality
202+
runs-on: ubuntu-latest
203+
needs: [analyze]
204+
if: >-
205+
!cancelled()
206+
&& (needs.analyze.result == 'success' || needs.analyze.result == 'skipped')
207+
208+
steps:
209+
210+
- name: Checkout
211+
uses: actions/checkout@v4
212+
213+
- name: Setup Python
214+
uses: actions/setup-python@v5
215+
with:
216+
python-version: 3.13.3
217+
218+
- name: Install dependencies
219+
run: |
220+
run "$python" -m pip install -c reqs/constraints.txt -r reqs/code_quality.txt
221+
222+
- name: Run Ruff (format check)
223+
run: ruff format --check .
224+
# }}}
225+
198226
# Job: Test (Linux) {{{
199227
test_linux:
200228

.github/workflows/ci/workflow_template.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,34 @@ jobs:
7272
release_skip_job: ${{ steps.set_ouputs.outputs.release_skip_job }}
7373
# }}}
7474

75+
# Job: Code Quality {{{
76+
code_quality:
77+
78+
name: Code Quality
79+
runs-on: ubuntu-latest
80+
needs: [analyze]
81+
if: >-
82+
!cancelled()
83+
&& (needs.analyze.result == 'success' || needs.analyze.result == 'skipped')
84+
85+
steps:
86+
87+
- name: Checkout
88+
uses: <@ action_checkout @>
89+
90+
- name: Setup Python
91+
uses: <@ action_setup_python @>
92+
with:
93+
python-version: <@ default_python @>
94+
95+
- name: Install dependencies
96+
run: |
97+
run "$python" -m pip install -c reqs/constraints.txt -r reqs/code_quality.txt
98+
99+
- name: Run Ruff (format check)
100+
run: ruff format --check .
101+
# }}}
102+
75103
<% for j in jobs %>
76104
# Job: <@ j.name @> {{{
77105
<@ j.id @>:

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: ruff-format
5+
name: ruff format
6+
entry: ruff format
7+
language: system
8+
types: [python]

reqs/code_quality.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruff

reqs/constraints.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pkginfo==1.12.1.2
3535
plover-stroke==1.1.0
3636
pluggy==1.5.0
3737
plyer==2.1.0
38+
pre-commit==4.2.0
3839
psutil==7.0.0
3940
py==1.11.0
4041
pycparser==2.22
@@ -57,12 +58,14 @@ requests-futures==1.0.2
5758
requests-toolbelt==1.0.0
5859
rfc3986==2.0.0
5960
rtf-tokenize==1.0.0
61+
ruff==0.12.0
6062
SecretStorage==3.3.3
6163
setuptools==79.0.0
6264
six==1.17.0
6365
toml==0.10.2
6466
tomli==2.2.1
6567
towncrier==24.8.0
68+
tox==4.27.0
6669
tqdm==4.67.1
6770
twine==6.1.0
6871
url-normalize==2.2.0

reqs/dev.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-r ci.txt
2+
-r code_quality.txt
3+
pre-commit
4+
tox

0 commit comments

Comments
 (0)