forked from p15670423/monkey
Updated flake8 to fail if number of warnings is too high
This commit is contained in:
parent
d5bc218996
commit
ea5ae67891
28
.travis.yml
28
.travis.yml
|
@ -1,23 +1,41 @@
|
||||||
# Infection Monkey travis.yml. See Travis documentation for information about this file structure.
|
# Infection Monkey travis.yml. See Travis documentation for information about this file structure.
|
||||||
|
|
||||||
group: travis_latest
|
group: travis_latest
|
||||||
|
|
||||||
language: python
|
language: python
|
||||||
|
|
||||||
cache: pip
|
cache: pip
|
||||||
|
|
||||||
python:
|
python:
|
||||||
- 3.7
|
- 3.7
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- pip install -r monkey/monkey_island/requirements.txt # for unit tests
|
- pip install -r monkey/monkey_island/requirements.txt # for unit tests
|
||||||
- pip install flake8 pytest dlint # for next stages
|
- pip install flake8 pytest dlint # for next stages
|
||||||
- pip install -r monkey/infection_monkey/requirements_linux.txt # for unit tests
|
- pip install -r monkey/infection_monkey/requirements_linux.txt # for unit tests
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics # Check syntax errors
|
# Check syntax errors and fail the build if any are found.
|
||||||
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics # warn about linter issues. --exit-zero
|
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
|
||||||
# means this stage will not fail the build. This is (hopefully) a temporary measure until all warnings are suppressed.
|
|
||||||
- python monkey/monkey_island/cc/set_server_config.py testing # Set the server config to `testing`, for the UTs to use
|
# Warn about linter issues.
|
||||||
# mongomaock and pass.
|
# --exit-zero forces Flake8 to use the exit status code 0 even if there are errors, which means this will NOT fail the build.
|
||||||
|
# --count will print the total number of errors.
|
||||||
|
# --statistics Count the number of occurrences of each error/warning code and print a report.
|
||||||
|
# The output is redirected to a file.
|
||||||
|
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics > flake8_warnings.txt
|
||||||
|
# Display the linter issues
|
||||||
|
- cat flake8_warnings.txt
|
||||||
|
# Make sure that we haven't increased the amount of warnings.
|
||||||
|
- test (`tail -n 1 flake8_warnings.txt` -lt 180)
|
||||||
|
|
||||||
|
# Set the server config to `testing`, for the UTs to use mongomaock and pass.
|
||||||
|
- python monkey/monkey_island/cc/set_server_config.py testing
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- cd monkey # This is our source dir
|
- cd monkey # This is our source dir
|
||||||
- python -m pytest # Have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path.
|
- python -m pytest # Have to use `python -m pytest` instead of `pytest` to add "{$builddir}/monkey/monkey" to sys.path.
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
slack: # Notify to slack
|
slack: # Notify to slack
|
||||||
rooms:
|
rooms:
|
||||||
|
|
Loading…
Reference in New Issue