Skip to content

Commit 937e003

Browse files
committed
♻️ Move Ruff linting logic to scripts/ruff
1 parent 1f2e9e8 commit 937e003

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

.github/workflows/ci.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ jobs:
4747
- name: Install dependencies
4848
run: pdm install -G lint --frozen-lockfile
4949
- name: Lint with ruff
50-
run: |
51-
pdm run ruff check .
52-
pdm run ruff format --check .
50+
run: pdm run lint-ruff
5351
- name: Type check with mypy
5452
run: pdm run mypy

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ RUN emerge -q dev-python/tox
1010

1111
WORKDIR /usr/src/gcm
1212
COPY pyproject.toml README.md tox.ini ./
13+
COPY scripts scripts
1314
COPY src src
1415
COPY tests tests
1516

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ test = [
6464
"pytest-env",
6565
]
6666

67+
[tool.pdm.scripts]
68+
lint-ruff = "scripts/ruff"
69+
6770
[tool.ruff]
6871
line-length = 79
6972

scripts/ruff

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
ruff check src
6+
ruff check tests \
7+
--config 'lint.isort.known-first-party = ["gcm"]' \
8+
--config 'lint.isort.known-local-folder = ["tests"]'
9+
ruff format --check

tox.ini

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ commands = pytest -v
1515
[testenv:lint-ruff]
1616
skip_install = true
1717
deps = ruff
18-
commands =
19-
ruff check .
20-
ruff format --check .
18+
allowlist_externals = scripts/ruff
19+
commands = scripts/ruff
2120

2221
[testenv:lint-mypy]
2322
package = editable

0 commit comments

Comments
 (0)