Switch from flake8 to pytest-{mccabe,flakes,pep8}.
This commit is contained in:
parent
d8e58b5886
commit
36803cba06
13
.flake8
13
.flake8
@ -1,13 +0,0 @@
|
||||
# vim: ft=dosini fileencoding=utf-8:
|
||||
|
||||
[flake8]
|
||||
# E265: Block comment should start with '#'
|
||||
# E501: Line too long
|
||||
# F841: unused variable
|
||||
# F401: Unused import
|
||||
# E402: module level import not at top of file
|
||||
# E266: too many leading '#' for block comment
|
||||
# W503: line break before binary operator
|
||||
ignore=E265,E501,F841,F401,E402,E266,W503
|
||||
max_complexity = 12
|
||||
exclude=resources.py
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -22,3 +22,4 @@ __pycache__
|
||||
/htmlcov
|
||||
/.tox
|
||||
/testresults.html
|
||||
/.cache
|
||||
|
@ -93,7 +93,9 @@ Currently, the following tools will be invoked when you run `tox`:
|
||||
|
||||
* Unit tests using the Python
|
||||
https://docs.python.org/3.4/library/unittest.html[unittest] framework
|
||||
* https://pypi.python.org/pypi/flake8/[flake8]
|
||||
* https://pypi.python.org/pypi/pyflakes[pyflakes] via https://pypi.python.org/pypi/pytest-flakes[pytest-flakes]
|
||||
* https://pypi.python.org/pypi/pep8[pep8] via https://pypi.python.org/pypi/pytest-pep8[pytest-pep8]
|
||||
* https://pypi.python.org/pypi/mccabe[mccabe] via https://pypi.python.org/pypi/pytest-mccabe[pytest-mccabe]
|
||||
* https://github.com/GreenSteam/pep257/[pep257]
|
||||
* http://pylint.org/[pylint]
|
||||
* https://pypi.python.org/pypi/pyroma/[pyroma]
|
||||
|
@ -28,7 +28,6 @@ include doc/qutebrowser.1.asciidoc
|
||||
prune tests
|
||||
exclude qutebrowser.rcc
|
||||
exclude .coveragerc
|
||||
exclude .flake8
|
||||
exclude .pylintrc
|
||||
exclude .eslintrc
|
||||
exclude doc/help
|
||||
|
@ -606,7 +606,7 @@ class Quitter:
|
||||
# event loop, so we can shut down immediately.
|
||||
self._shutdown(status)
|
||||
|
||||
def _shutdown(self, status): # noqa
|
||||
def _shutdown(self, status):
|
||||
"""Second stage of shutdown."""
|
||||
log.destroy.debug("Stage 2 of shutting down...")
|
||||
if qApp is None:
|
||||
|
@ -181,7 +181,7 @@ class NetworkManager(QNetworkAccessManager):
|
||||
request.deleteLater()
|
||||
self.shutting_down.emit()
|
||||
|
||||
if SSL_AVAILABLE: # noqa
|
||||
if SSL_AVAILABLE: # pragma: no mccabe
|
||||
@pyqtSlot('QNetworkReply*', 'QList<QSslError>')
|
||||
def on_ssl_errors(self, reply, errors):
|
||||
"""Decide if SSL errors should be ignored or not.
|
||||
|
@ -420,7 +420,7 @@ class Command:
|
||||
value = self._type_conv[param.name](value)
|
||||
return name, value
|
||||
|
||||
def _get_call_args(self, win_id): # noqa
|
||||
def _get_call_args(self, win_id):
|
||||
"""Get arguments for a function call.
|
||||
|
||||
Args:
|
||||
|
@ -190,7 +190,7 @@ class CrashHandler(QObject):
|
||||
objects = ""
|
||||
return ExceptionInfo(pages, cmd_history, objects)
|
||||
|
||||
def exception_hook(self, exctype, excvalue, tb): # noqa
|
||||
def exception_hook(self, exctype, excvalue, tb):
|
||||
"""Handle uncaught python exceptions.
|
||||
|
||||
It'll try very hard to write all open tabs to a file, and then exit
|
||||
|
@ -55,7 +55,7 @@ class ShellLexer:
|
||||
self.token = ''
|
||||
self.state = ' '
|
||||
|
||||
def __iter__(self): # noqa
|
||||
def __iter__(self): # pragma: no mccabe
|
||||
"""Read a raw token from the input stream."""
|
||||
# pylint: disable=too-many-branches,too-many-statements
|
||||
self.reset()
|
||||
|
50
tox.ini
50
tox.ini
@ -4,7 +4,7 @@
|
||||
# and then run "tox" from this directory.
|
||||
|
||||
[tox]
|
||||
envlist = unittests,misc,pep257,flake8,pylint,pyroma,check-manifest
|
||||
envlist = unittests,misc,pep257,pyflakes,pep8,mccabe,pylint,pyroma,check-manifest
|
||||
|
||||
[testenv]
|
||||
basepython = python3
|
||||
@ -74,16 +74,40 @@ passenv = LANG
|
||||
# D402: First line should not be function's signature (false-positives)
|
||||
commands = {envpython} -m pep257 scripts tests qutebrowser --ignore=D102,D103,D209,D402 '--match=(?!resources|test_content_disposition).*\.py'
|
||||
|
||||
[testenv:flake8]
|
||||
skip_install = true
|
||||
[testenv:pyflakes]
|
||||
# https://github.com/fschulze/pytest-flakes/issues/6
|
||||
setenv = LANG=en_US.UTF-8
|
||||
deps =
|
||||
-r{toxinidir}/requirements.txt
|
||||
pyflakes==0.8.1
|
||||
pep8==1.5.7 # rq.filter: <1.6.0
|
||||
flake8==2.4.0
|
||||
py==1.4.27
|
||||
pytest==2.7.1
|
||||
pyflakes==0.9.0
|
||||
pytest-flakes==0.2
|
||||
commands =
|
||||
{[testenv:mkvenv]commands}
|
||||
{envdir}/bin/flake8 scripts tests qutebrowser --config=.flake8
|
||||
{envpython} -m py.test -q --flakes -m flakes
|
||||
|
||||
[testenv:pep8]
|
||||
deps =
|
||||
-r{toxinidir}/requirements.txt
|
||||
py==1.4.27
|
||||
pytest==2.7.1
|
||||
pep8==1.6.2
|
||||
pytest-pep8==1.0.6
|
||||
commands =
|
||||
{[testenv:mkvenv]commands}
|
||||
{envpython} -m py.test -q --pep8 -m pep8
|
||||
|
||||
[testenv:mccabe]
|
||||
deps =
|
||||
-r{toxinidir}/requirements.txt
|
||||
py==1.4.27
|
||||
pytest==2.7.1
|
||||
mccabe==0.3
|
||||
pytest-mccabe==0.1
|
||||
commands =
|
||||
{[testenv:mkvenv]commands}
|
||||
{envpython} -m py.test -q --mccabe -m mccabe
|
||||
|
||||
[testenv:pyroma]
|
||||
skip_install = true
|
||||
@ -129,3 +153,15 @@ commands =
|
||||
norecursedirs = .tox .venv
|
||||
markers =
|
||||
gui: Tests using the GUI (e.g. spawning widgets)
|
||||
flakes-ignore =
|
||||
UnusedImport
|
||||
UnusedVariable
|
||||
resources.py ALL
|
||||
pep8ignore =
|
||||
E265 # Block comment should start with '#'
|
||||
E501 # Line too long
|
||||
E402 # module level import not at top of file
|
||||
E266 # too many leading '#' for block comment
|
||||
W503 # line break before binary operator
|
||||
resources.py ALL
|
||||
mccabe-complexity = 12
|
||||
|
Loading…
Reference in New Issue
Block a user