Merge pull request #763 from mozilla/enable_flake8_check

Add flake8 checks to travisci
This commit is contained in:
Brandon Myers 2018-10-05 16:39:06 -04:00 коммит произвёл GitHub
Родитель 732681b927 92702d7115
Коммит 18781fe276
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 66 добавлений и 4 удалений

58
.flake8 Normal file
Просмотреть файл

@ -0,0 +1,58 @@
[flake8]
exclude =
.flake8
.git
*__init__.py
ignore =
E111 # indentation is not a multiple of four
E114 # indentation is not a multiple of four (comment)
E116 # unexpected indentation (comment)
E121 # continuation line under-indented for hanging indent
E122 # continuation line missing indentation or outdented
E123 # closing bracket does not match indentation of opening bracket's line
E124 # closing bracket does not match visual indentation
E125 # continuation line with same indent as next logical line
E126 # continuation line over-indented for hanging indent
E127 # continuation line over-indented for visual indent
E128 # continuation line under-indented for visual indent
E129 # visually indented line with same indent as next logical line
E131 # continuation line unaligned for hanging indent
E201 # whitespace after '('
E202 # whitespace before ')'
E203 # whitespace before '
E211 # whitespace before '('
E221 # multiple spaces before operator
E222 # multiple spaces after operator
E225 # missing whitespace around operator
E226 # missing whitespace around arithmetic operator
E228 # missing whitespace around modulo operator
E231 # missing whitespace after ','
E241 # multiple spaces after ','
E251 # unexpected spaces around keyword / parameter equals
E261 # at least two spaces before inline comment
E262 # inline comment should start with '# '
E265 # block comment should start with '# '
E266 # too many leading '#' for block comment
E271 # multiple spaces after keyword
E301 # expected 1 blank line
E302 # expected 2 blank lines, found 1
E303 # too many blank lines (3)
E305 # expected 2 blank lines after class or function definition
E402 # module level import not at top of file
E501 # line too long
E502 # the backslash is redundant between brackets
E711 # comparison to None should be 'if cond is not None
E712 # comparison to True should be 'if cond is True
E713 # test for membership should be 'not in'
E722 # do not use bare except'
F401 # library imported but unused
F601 # dictionary key 'tags' repeated with different values
F811 # redefinition of unused 'datetime' from line 10
F821 # undefined name 'SysLogHandler'
F841 # local variable 'CIDR' is assigned to but never used
W291 # trailing whitespace
W292 # no newline at end of file
W293 # blank line contains whitespace
W391 # blank line at end of file
W503 # line break before binary operator
W601 # .has_key() is deprecated, use 'in'

Просмотреть файл

@ -17,5 +17,7 @@ before_script:
# Give some time for Elasticsearch to start up
- sleep 10
script:
# Verify pep8
- docker run -it mozdef_tester bash -c "source /opt/mozdef/envs/python/bin/activate && flake8 --config .flake8 ./"
# Run unit tests
- docker run -it --network=mozdef_default mozdef_tester bash -c "source /opt/mozdef/envs/python/bin/activate && py.test --delete_indexes --delete_queues tests"

Просмотреть файл

@ -6,6 +6,7 @@ COPY mq /opt/mozdef/envs/mozdef/mq
COPY loginput /opt/mozdef/envs/mozdef/loginput
COPY rest /opt/mozdef/envs/mozdef/rest
COPY cron /opt/mozdef/envs/mozdef/cron
COPY .flake8 /opt/mozdef/envs/mozdef/.flake8
COPY docker/compose/tester/files/tests_config.conf /opt/mozdef/envs/mozdef/tests/config.conf
COPY docker/compose/tester/files/loginput_config.conf /opt/mozdef/envs/mozdef/loginput/index.conf

Просмотреть файл

@ -1,4 +1,5 @@
pytest==3.1.1
mock==2.0.0
WebTest==2.0.27
freezegun==0.3.9
flake8==3.5.0
mock==2.0.0
pytest==3.1.1
WebTest==2.0.27