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:
ein 2022-01-30 10:31:54 -08:00
parent 498aa770f7
commit a67d265951
2 changed files with 11 additions and 3 deletions

View File

@ -9,8 +9,18 @@ variables:
DOCKER_DRIVER: overlay2 DOCKER_DRIVER: overlay2
stages: stages:
- test
- deploy - 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: build_and_push_container:
stage: deploy stage: deploy
script: script:

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

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