diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..8c356a2 --- /dev/null +++ b/.pre-commit-config.yaml @@ -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 \ No newline at end of file diff --git a/Makefile b/Makefile index d5d27a5..1e7596c 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,14 @@ -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 deploy--sls: @echo "Deploying via serverless framework" - @. cd apps/http/sls && pdm export -G sls -f requirements --prod > requirements.txt && npx sls deploy \ No newline at end of file + @. 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 \ No newline at end of file diff --git a/apps/http/apischema.yml b/apps/http/apischema.yml index 8e18d2e..c41b9fe 100644 --- a/apps/http/apischema.yml +++ b/apps/http/apischema.yml @@ -109,4 +109,4 @@ components: type: object properties: pair: - type: string \ No newline at end of file + type: string diff --git a/apps/http/chalice/.chalice/config.json b/apps/http/chalice/.chalice/config.json index 5958d89..1bdea33 100644 --- a/apps/http/chalice/.chalice/config.json +++ b/apps/http/chalice/.chalice/config.json @@ -5,4 +5,4 @@ "dev": { } } -} \ No newline at end of file +} diff --git a/apps/http/sls/requirements.txt b/apps/http/sls/requirements.txt index acfb987..2dbba36 100644 --- a/apps/http/sls/requirements.txt +++ b/apps/http/sls/requirements.txt @@ -241,4 +241,3 @@ yarl==1.9.4 \ --hash=sha256:e23a6d84d9d1738dbc6e38167776107e63307dfc8ad108e580548d1f2c587f42 \ --hash=sha256:ea65804b5dc88dacd4a40279af0cdadcfe74b3e5b4c897aa0d81cf86927fee78 \ --hash=sha256:ee04010f26d5102399bd17f8df8bc38dc7ccd7701dc77f4a68c5b8d733406958 - diff --git a/apps/http/sls/serverless.yml b/apps/http/sls/serverless.yml index d13eda0..a496e21 100644 --- a/apps/http/sls/serverless.yml +++ b/apps/http/sls/serverless.yml @@ -70,4 +70,4 @@ functions: events: - httpApi: path: /api/v1/groups/{group_uuid}/pair/{participant} - method: get \ No newline at end of file + method: get diff --git a/pyproject.toml b/pyproject.toml index e473aab..9a4b1eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,6 +33,7 @@ chalice = [ sls = [ "anyio>=4.1.0", ] + [build-system] requires = ["pdm-backend"] build-backend = "pdm.backend" diff --git a/secretsanta/repo.py b/secretsanta/repo.py index 151dd5f..af7da1b 100644 --- a/secretsanta/repo.py +++ b/secretsanta/repo.py @@ -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