Skip to content

Commit 2f45cd5

Browse files
committed
Add ruff
1 parent 6cda453 commit 2f45cd5

File tree

4 files changed

+71
-14
lines changed

4 files changed

+71
-14
lines changed

.github/workflows/ci.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint and Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: Install Python
11+
uses: actions/setup-python@v5
12+
with:
13+
python-version: "3.11"
14+
- name: Install dependencies
15+
run: |
16+
pipx install poetry
17+
poetry export --only dev --output linter-requirements.txt
18+
pip install -r linter-requirements.txt
19+
- name: Run Ruff
20+
run: ruff check --output-format=github .

.pre-commit-config.yaml

+10-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,13 @@ repos:
1212
hooks:
1313
- id: flake8
1414
exclude: "src/tests/"
15-
additional_dependencies: [Flake8-pyproject]
15+
additional_dependencies: [Flake8-pyproject]
16+
- repo: https://github.com/astral-sh/ruff-pre-commit
17+
# Ruff version.
18+
rev: v0.3.0
19+
hooks:
20+
# Run the linter.
21+
- id: ruff
22+
args: [ --fix ]
23+
# Run the formatter.
24+
- id: ruff-format

poetry.lock

+28-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+13-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ readme = "README.md"
77

88

99
[tool.poetry.dependencies]
10-
python = "3.11.6"
10+
python = "3.11.3"
1111
fastapi = "^0.103.1"
1212
pydantic = {extras = ["email"], version = "^2.3.0"}
1313
uvicorn = "^0.23.2"
@@ -34,6 +34,7 @@ Pillow = "10.1.0"
3434
sentry-sdk = {extras = ["asyncpg", "fastapi"], version = "^1.39.1"}
3535

3636

37+
3738
[tool.poetry.group.dev.dependencies]
3839
pytest = "^7.4.2"
3940
isort = "^5.12.0"
@@ -43,11 +44,21 @@ flake8-pyproject = "^1.2.3"
4344
pytest-asyncio = "^0.21.1"
4445
pytest-env = "^1.0.1"
4546
pytest-mock = "^3.11.1"
47+
ruff = "0.3.0"
48+
4649

4750
[build-system]
4851
requires = ["poetry-core"]
4952
build-backend = "poetry.core.masonry.api"
5053

54+
[tool.ruff]
55+
line-length = 120
56+
57+
[tool.ruff.lint]
58+
extend-select = ["W", "E", "I"]
59+
preview = true
60+
61+
5162
[tool.black]
5263
line-length = 120
5364

@@ -58,6 +69,7 @@ skip_glob = ["**/migrations/**"]
5869

5970
[tool.flake8]
6071
max-line-length = 120
72+
exclude = ["tests"]
6173

6274
[tool.pytest.ini_options]
6375
filterwarnings = ["ignore::DeprecationWarning"]

0 commit comments

Comments
 (0)