From ecfc59cfd7883a0b7b77cc649e6bd01bf8e44996 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Thu, 1 Apr 2021 12:50:49 -0400 Subject: [PATCH] ci: fail the build if code is not formatted with black --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 509da86ac..8cbdb7ac9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ install: # Python - pip freeze - pip install -r monkey/monkey_island/requirements.txt # for unit tests -- pip install flake8 pytest pytest-cov dlint isort # for next stages +- pip install black flake8 pytest pytest-cov dlint isort # for next stages - pip install coverage # for code coverage - pip install -r monkey/infection_monkey/requirements.txt # for unit tests - pip install pipdeptree @@ -70,6 +70,9 @@ script: ## Check import order - python -m isort ./monkey --settings-file ./ci_scripts/isort.cfg +## Check that all python is properly formatted. Fail otherwise. +- python -m black --check . + ## Run unit tests and generate coverage data - cd monkey # This is our source dir - python -m pytest --cov=. # Have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path.