From 492d28c04cc559e61b80ed04432e85a77097c27a Mon Sep 17 00:00:00 2001 From: Drew Bednar Date: Fri, 30 Sep 2022 21:06:17 -0400 Subject: [PATCH] Add shell check to pre-commit --- .pre-commit-config.yaml | 4 ++++ README.md | 2 ++ compose/local/fastapi/celery/beat/{start => start.sh} | 0 compose/local/fastapi/celery/flower/{start => start.sh} | 0 compose/local/fastapi/celery/worker/{start => start.sh} | 2 +- compose/local/fastapi/{start => start.sh} | 0 dev-requirements.in | 1 + dev-requirements.txt | 2 ++ requirements.in | 1 + 9 files changed, 11 insertions(+), 1 deletion(-) rename compose/local/fastapi/celery/beat/{start => start.sh} (100%) rename compose/local/fastapi/celery/flower/{start => start.sh} (100%) rename compose/local/fastapi/celery/worker/{start => start.sh} (87%) rename compose/local/fastapi/{start => start.sh} (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8d02c83..e9882da 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,9 @@ default_stages: [commit, push] repos: + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.8.0.4 + hooks: + - id: shellcheck - repo: https://github.com/pre-commit/pre-commit-hooks rev: v3.2.0 hooks: diff --git a/README.md b/README.md index c3afb70..6a370d2 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Learning distributed task queues by doing. Since it's a greenfield project this also uses a newer async web framework. +See: [Celery docs](https://celery-safwan.readthedocs.io/en/latest/index.html) + ## Debugging Celery ### Check results in redis result backend diff --git a/compose/local/fastapi/celery/beat/start b/compose/local/fastapi/celery/beat/start.sh similarity index 100% rename from compose/local/fastapi/celery/beat/start rename to compose/local/fastapi/celery/beat/start.sh diff --git a/compose/local/fastapi/celery/flower/start b/compose/local/fastapi/celery/flower/start.sh similarity index 100% rename from compose/local/fastapi/celery/flower/start rename to compose/local/fastapi/celery/flower/start.sh diff --git a/compose/local/fastapi/celery/worker/start b/compose/local/fastapi/celery/worker/start.sh similarity index 87% rename from compose/local/fastapi/celery/worker/start rename to compose/local/fastapi/celery/worker/start.sh index fed8d71..03ebeae 100644 --- a/compose/local/fastapi/celery/worker/start +++ b/compose/local/fastapi/celery/worker/start.sh @@ -6,7 +6,7 @@ set -o nounset # Use watchfiles during development CELERY_WORKER_WATCH=${CELERY_WORKER_WATCH:-} -if [ ! -z $CELERY_WORKER_WATCH ]; then +if [ -n "${CELERY_WORKER_WATCH}" ]; then watchfiles --filter python 'celery -A main.celery worker --loglevel=info' else exec python -m celery -A main.celery worker --loglevel=info diff --git a/compose/local/fastapi/start b/compose/local/fastapi/start.sh similarity index 100% rename from compose/local/fastapi/start rename to compose/local/fastapi/start.sh diff --git a/dev-requirements.in b/dev-requirements.in index b399c9f..0243c76 100644 --- a/dev-requirements.in +++ b/dev-requirements.in @@ -5,3 +5,4 @@ pip-tools==6.8.0 pre-commit==2.20.0 pylint==2.15.2 pytest==7.1.3 +shellcheck-py==0.8.0.4 diff --git a/dev-requirements.txt b/dev-requirements.txt index 982c292..d3ac8c6 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -77,6 +77,8 @@ pytest==7.1.3 # via -r dev-requirements.in pyyaml==6.0 # via pre-commit +shellcheck-py==0.8.0.4 + # via -r dev-requirements.in toml==0.10.2 # via pre-commit tomli==2.0.1 diff --git a/requirements.in b/requirements.in index 41cc19d..252c5fa 100644 --- a/requirements.in +++ b/requirements.in @@ -4,6 +4,7 @@ fastapi==0.79.0 flower==1.2.0 psycopg2-binary==2.9.3 redis==4.3.4 +shellcheck-py==0.8.0.4 SQLAlchemy==1.4.40 uvicorn[standard]==0.18.2 watchfiles==0.17.0