Run pre-commit for linting in Docker

This commit is contained in:
Bruno Alla 2021-03-03 19:53:56 +00:00
parent c7bb4834e0
commit e08b17a234
3 changed files with 9 additions and 3 deletions

View File

@ -8,6 +8,7 @@ black==20.8b1
isort==5.8.0
flake8==3.9.0
flake8-isort==4.0.0
pre-commit==2.10.1
# Testing
# ------------------------------------------------------------------------------

View File

@ -28,6 +28,7 @@ sudo utility/install_os_dependencies.sh install
pip install -r requirements/local.txt
# Lint by running pre-commit on all files
# Needs a git repo to find the project root
git init
git add .
pre-commit run --show-diff-on-failure -a

View File

@ -17,12 +17,16 @@ cd .cache/docker
cookiecutter ../../ --no-input --overwrite-if-exists use_docker=y $@
cd my_awesome_project
# Lint by running pre-commit on all files
# Needs a git repo to find the project root
# We don't have git inside Docker, so run it outside
git init
git add .
pre-commit run --show-diff-on-failure -a
# run the project's type checks
docker-compose -f local.yml run django mypy my_awesome_project
# Run black with --check option
docker-compose -f local.yml run django black --check --diff --exclude 'migrations' ./
# run the project's tests
docker-compose -f local.yml run django pytest