Skip to content

Commit a1e3853

Browse files
author
Sven Groot
committed
Add ruff linting and formatter
Closes #62
1 parent 665335f commit a1e3853

File tree

4 files changed

+49
-1
lines changed

4 files changed

+49
-1
lines changed

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# https://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
indent_size = 4
9+
indent_style = space
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
[*.{yml,yaml}]
14+
indent_size = 2

.github/workflows/ruff.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Lint and format
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- main
7+
pull_request:
8+
paths-ignore:
9+
- '**.md'
10+
11+
jobs:
12+
ruff:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: astral-sh/ruff-action@v3
17+
- run: ruff check
18+
- run: ruff format --check

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ coverage.xml
5151
.pytest_cache/
5252
cover/
5353

54+
# Linter / formatter
55+
.ruff_cache
56+
5457
# Translations
5558
*.mo
5659
*.pot
@@ -163,4 +166,4 @@ cython_debug/
163166
poetry.lock
164167

165168
.DS_Store
166-
.tool-versions
169+
.tool-versions

pyproject.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,20 @@ requests = "^2"
2727
[tool.poetry.dev-dependencies]
2828
pytest = "^7.1.2"
2929
pytest-django = "^4.5.2"
30+
ruff = "^0.8.6"
3031

3132
[build-system]
3233
requires = ["poetry-core>=1.0.0"]
3334
build-backend = "poetry.core.masonry.api"
35+
36+
[tool.ruff.lint]
37+
select = [
38+
"E", # pycodestyle
39+
"W", # pycodestyle
40+
"F", # Pyflakes
41+
"B", # flake8-bugbear
42+
"SIM", # flake8-simplify
43+
"I", # isort
44+
]
45+
ignore = ["E501"] # line too long, formatter will handle this
46+
unfixable = ["B", "SIM"]

0 commit comments

Comments
 (0)