Skip to content

Commit 3d667f3

Browse files
authored
Lint and format with ruff (#11)
2 parents 34c55d5 + 2df010d commit 3d667f3

File tree

7 files changed

+187
-127
lines changed

7 files changed

+187
-127
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Run `make lint test`: flake8 and pytest.
2-
name: python-lint-test
2+
name: python-test
33

44
on:
55
push:
@@ -8,31 +8,24 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11-
build:
12-
11+
test:
1312
runs-on: ubuntu-latest
1413
strategy:
14+
fail-fast: false
1515
matrix:
16-
python-version: ["3.8", "3.9", "3.10"]
17-
16+
python-version: ["3.7", "3.10", "3.11"]
1817
steps:
19-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v3
2019
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v2
20+
uses: actions/setup-python@v4
2221
with:
2322
python-version: ${{ matrix.python-version }}
23+
cache: 'pip'
2424
- name: Install dependencies
2525
run: |
2626
python -m pip install --upgrade pip
2727
pip install -r requirements.txt
28-
- name: Audit dependencies
29-
run: |
30-
make -B audit
31-
- name: Set up flake8 annotations
32-
uses: rbialon/flake8-annotations@v1
33-
- name: Lint with flake8
34-
run: |
35-
make -B lint
3628
- name: Test with pytest
3729
run: |
30+
pip install pytest
3831
make -B test
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: static-analysis
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
format:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Check format with ruff
15+
uses: astral-sh/ruff-action@v1
16+
with:
17+
args: check --verbose
18+
lint:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
- name: Set up flake8 annotations
23+
uses: rbialon/flake8-annotations@v1
24+
- name: Lint with ruff
25+
uses: chartboost/ruff-action@v1
26+
audit:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v3
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install -r requirements.txt
34+
- name: Audit dependencies
35+
run: |
36+
make -B audit

Makefile

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
source := ${wildcard ./jsonfeed/**/*.py}
22
tests := ${wildcard tests/*.py}
33

4-
.PHONY: all lint test audit docs clean
4+
.PHONY: all format lint test audit docs clean
55

66
all: lint test docs
77

8+
format: $(source) $(tests)
9+
ruff format .
10+
811
lint: $(source) $(tests)
9-
flake8 . --count --max-complexity=10 --statistics
12+
ruff check .
1013

1114
test: $(source) $(tests)
1215
pytest

0 commit comments

Comments
 (0)