Adding a lint phase to the ci/cd pipeline. This should fail because animals.py is not formatted properly according to black

This commit is contained in:
Luke Robles 2022-01-30 10:31:54 -08:00
parent ca49a70cc7
commit 6244e5567e
2 changed files with 11 additions and 3 deletions

View File

@ -9,8 +9,18 @@ variables:
DOCKER_DRIVER: overlay2
stages:
- test
- deploy
lint_python_on_merge_request:
image: python:alpine
stage: test
script:
- echo "Linting Python code"
- pip install black && black --fast --check .
build_and_push_container:
stage: deploy
script:

4
app/animals.py Executable file → Normal file
View File

@ -9,9 +9,7 @@ import get_from_reddit
def get_red_panda():
red_panda = None
while not red_panda:
red_panda = requests.get("https://some-random-api.ml/img/red_panda").json()[
"link"
]
red_panda = requests.get("https://some-random-api.ml/img/red_panda").json()["link"]
return red_panda