chore: add pre-commit

This commit is contained in:
cătălin 2023-12-08 17:08:03 +01:00
commit 72ee09b064
Signed by: catalin
GPG key ID: 0178DF42F43E5FD2
8 changed files with 40 additions and 13 deletions

28
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,28 @@
files: ^secretsanta|apps|tests$
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
args: [ --markdown-linebreak-ext=md ]
- id: end-of-file-fixer
- id: check-ast
- id: check-added-large-files
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-docstring-first
- id: check-merge-conflict
- id: check-toml
- id: debug-statements
- id: mixed-line-ending
args: [ --fix=lf ]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.6
hooks:
- id: ruff
args:
- --fix
- --exit-non-zero-on-fix
- id: ruff-format

View file

@ -1,10 +1,3 @@
install:
@echo "Installing pdm packages"
@. pdm install
@echo "Installing node packages"
@. cd apps/http/sls npm i
run--sls:
@echo "Activating virtual environment and starting serverless offline"
@. .venv/bin/activate && cd apps/http/sls && npx sls offline
@ -12,3 +5,10 @@ run--sls:
deploy--sls:
@echo "Deploying via serverless framework"
@. cd apps/http/sls && pdm export -G sls -f requirements --prod > requirements.txt && npx sls deploy
lint:
pre-commit run --all-files --color always
tests--unit:
pdm run pytest --cov secretsanta tests
coverage html

View file

@ -241,4 +241,3 @@ yarl==1.9.4 \
--hash=sha256:e23a6d84d9d1738dbc6e38167776107e63307dfc8ad108e580548d1f2c587f42 \
--hash=sha256:ea65804b5dc88dacd4a40279af0cdadcfe74b3e5b4c897aa0d81cf86927fee78 \
--hash=sha256:ee04010f26d5102399bd17f8df8bc38dc7ccd7701dc77f4a68c5b8d733406958

View file

@ -33,6 +33,7 @@ chalice = [
sls = [
"anyio>=4.1.0",
]
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"

View file

@ -2,7 +2,6 @@ import json
from contextlib import asynccontextmanager
import aioboto3
import botocore
from botocore.exceptions import ClientError
from secretsanta.domain import Group, IRepo