Skip to content

Commit 9f7c3bf

Browse files
committed
chore: настроить качественный pre-commit для репозитория
Что сделано: - добавлен .pre-commit-config.yaml с базовыми проверками репозитория - подключены хуки pre-commit-hooks: yaml/json/toml, merge-conflict, whitespace, eof, large files - подключены ruff и ruff-format для проверки и форматирования Python кода - добавлены just-команды pre-commit-install, pre-commit-run, pre-commit-update - установлен git hook pre-commit и подтвержден успешный прогон по всем файлам
1 parent e9d19fd commit 9f7c3bf

4 files changed

Lines changed: 34 additions & 1 deletion

File tree

.pre-commit-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
minimum_pre_commit_version: "3.7.0"
2+
default_stages: [pre-commit]
3+
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v5.0.0
7+
hooks:
8+
- id: check-merge-conflict
9+
- id: end-of-file-fixer
10+
- id: trailing-whitespace
11+
- id: check-yaml
12+
- id: check-json
13+
- id: check-toml
14+
- id: check-added-large-files
15+
16+
- repo: https://github.com/astral-sh/ruff-pre-commit
17+
rev: v0.15.5
18+
hooks:
19+
- id: ruff
20+
- id: ruff-format

Justfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@ db-shell:
5656
redis-cli:
5757
docker compose exec redis redis-cli
5858

59+
# Установить git pre-commit hook в локальный репозиторий.
60+
pre-commit-install:
61+
uv run pre-commit install
62+
63+
# Прогнать pre-commit проверки по всем файлам.
64+
pre-commit-run:
65+
uv run pre-commit run --all-files
66+
67+
# Обновить версии хуков в .pre-commit-config.yaml.
68+
pre-commit-update:
69+
uv run pre-commit autoupdate
70+
5971
# Проверить код линтером Ruff (без автоисправлений).
6072
lint:
6173
uv run ruff check .

alembic/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Generic single-database configuration with an async dbapi.
1+
Generic single-database configuration with an async dbapi.

app/security/password.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ async def hash_password(*, password: str) -> str:
4848

4949
async def verify_password(*, password: str, hashed_password: str) -> bool:
5050
with tracer.start_as_current_span("security.password.verify_argon2"):
51+
5152
def _verify() -> bool:
5253
if len(password) > settings.ARGON_MAX_PASSWORD_LEN:
5354
return False

0 commit comments

Comments
 (0)