Skip to content

Commit 9ab290e

Browse files
committed
style: adding linting and formating checks
1 parent 6de461a commit 9ab290e

3 files changed

Lines changed: 62 additions & 1 deletion

File tree

.github/workflows/lint.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Lint (Python)
2+
3+
on:
4+
pull_request:
5+
paths: ['src/**','tests/**','pyproject.toml','.ruff.toml','.github/workflows/lint.yml']
6+
push:
7+
branches: [ main ]
8+
paths: ['src/**','tests/**','pyproject.toml','.ruff.toml','.github/workflows/lint.yml']
9+
10+
concurrency:
11+
group: lint-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
lint:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.12'
22+
cache: 'pip'
23+
- name: Install Ruff
24+
run: pip install ruff
25+
- name: Ruff (lint)
26+
run: ruff check . --config deploy/docker/pyproject.toml --output-format=github
27+
- name: Ruff (format check)
28+
run: ruff format --check . --config deploy/docker/pyproject.toml

.pre-commit-config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
exclude: |
2+
(?x)^(
3+
deploy/|
4+
venv/|\.venv/|
5+
build/|dist/
6+
)
7+
8+
repos:
9+
- repo: https://github.com/astral-sh/ruff-pre-commit
10+
rev: v0.5.7 # pin to the same Ruff version you use in CI
11+
hooks:
12+
- id: ruff
13+
args: [--fix] # auto-fix lint issues on commit (drop if you prefer warnings only)
14+
- id: ruff-format # formatting (equivalent to: ruff format)
15+
16+
# Nice but optional hygiene hooks
17+
- repo: https://github.com/pre-commit/pre-commit-hooks
18+
rev: v4.6.0
19+
hooks:
20+
- id: end-of-file-fixer
21+
- id: trailing-whitespace

deploy/docker/pyproject.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name = "supervisor-webui"
33
version = "1.0"
44
description = "SupervisorWebUI webserver"
55
requires-python = ">=3.13"
6-
76
dependencies = [
87
"psycopg2-binary>=2.9",
98
"argparse",
@@ -13,3 +12,16 @@ dependencies = [
1312
"uvicorn[standard]>=0.27.1",
1413
"python-multipart"
1514
]
15+
16+
[tool.ruff]
17+
target-version = "py312"
18+
line-length = 100
19+
src = ["src"]
20+
extend-exclude = ["venv", ".venv", "build", "dist", "deploy"]
21+
22+
[tool.ruff.lint]
23+
select = ["E", "F", "I", "UP", "B", "SIM", "PL"]
24+
ignore = ["E203"]
25+
26+
[tool.ruff.format]
27+
quote-style = "double"

0 commit comments

Comments
 (0)