Skip to content

Commit 18a2d02

Browse files
committed
refactor: ruff Python linting over flake8 and black
Run linting workflow through uv and Python 3.13 with a cache.
1 parent d2ec63d commit 18a2d02

File tree

5 files changed

+17
-28
lines changed

5 files changed

+17
-28
lines changed

.github/workflows/test-python.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,25 @@ on:
1111

1212
jobs:
1313
test-python-linting:
14+
runs-on: "ubuntu-latest"
15+
strategy:
16+
fail-fast: false
1417
defaults:
1518
run:
1619
working-directory: python
17-
runs-on: ${{ matrix.os }}
18-
strategy:
19-
fail-fast: false
20-
matrix:
21-
os:
22-
- ubuntu-latest
23-
python-version: ["3.10"]
2420
steps:
2521
- uses: actions/checkout@v5
26-
- name: Set up Python ${{ matrix.python-version }}
27-
uses: actions/setup-python@v6
22+
23+
- name: Install uv and set the python version
24+
uses: astral-sh/setup-uv@v6
2825
with:
29-
python-version: ${{ matrix.python-version }}
26+
enable-cache: true
27+
python-version: "3.13"
28+
version: "0.8.17"
29+
3030
- name: Linting
31-
run: |
32-
python -m pip install pre-commit
33-
pre-commit run --all-files
34-
31+
run: uvx pre-commit run --all-files
32+
3533
test-python:
3634
runs-on: ${{ matrix.os }}
3735
defaults:

python/.pre-commit-config.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
repos:
2-
- repo: https://github.com/psf/black
3-
rev: 22.3.0
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.13.0
44
hooks:
5-
- id: black
6-
- repo: https://github.com/PyCQA/flake8
7-
rev: 4.0.1
8-
hooks:
9-
- id: flake8
10-
args: ['--max-line-length=130','--ignore=E203,W503']
5+
- id: ruff-check
6+
- id: ruff-format

python/cucumber_expressions/expression_parser.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class Parser(NamedTuple):
2323

2424

2525
class CucumberExpressionParser:
26-
2726
# text == whitespace | ')' | '}' | .
2827
@staticmethod
2928
def parse_text(parser: Parser):

python/pyproject.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,3 @@ combine_as_imports = true
5858
lines_between_types = 1
5959
lines_after_imports = 2
6060
src_paths = ["cucumber_expressions", "tests"]
61-
62-
63-
[tool.black]
64-
target-version = ['py38']

python/tests/test_expression_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test_documents_expression_generation(self):
4141
generated_expression.source == "I have {int} cucumbers and {float} tomato"
4242
)
4343
assert generated_expression.parameter_names[0] == "int"
44-
assert generated_expression.parameter_types[1].type == float
44+
assert generated_expression.parameter_types[1].type is float
4545

4646
def test_generates_expression_for_no_args(self):
4747
self._assert_expression("hello", [], "hello")

0 commit comments

Comments
 (0)