update flake8 and flake8-deprecated
Updated requirements and adjusted the configuration in `.flake8`; other files have been modified where the lack of per-file auto-ignore caused problems, where putty's `# flake8: disable=` syntax could be replaced with a simpler `noqa`, or where pylint directives already suppressed the same error.
This commit is contained in:
parent
03a9cbdfb4
commit
5ed8019115
18
.flake8
18
.flake8
@ -33,18 +33,12 @@ ignore =
|
|||||||
D102,D103,D104,D105,D209,D211,D402,D403
|
D102,D103,D104,D105,D209,D211,D402,D403
|
||||||
min-version = 3.4.0
|
min-version = 3.4.0
|
||||||
max-complexity = 12
|
max-complexity = 12
|
||||||
putty-auto-ignore = True
|
per-file-ignores =
|
||||||
putty-ignore =
|
tests/*/test_*.py : D100,D101,D401
|
||||||
/# pylint: disable=invalid-name/ : +N801,N806
|
tests/unit/browser/test_history.py : N806
|
||||||
/# pragma: no mccabe/ : +C901
|
tests/helpers/fixtures.py : N806
|
||||||
tests/*/test_*.py : +D100,D101,D401
|
tests/unit/browser/webkit/http/test_content_disposition.py : D400
|
||||||
tests/conftest.py : +F403
|
scripts/dev/ci/appveyor_install.py : FI53
|
||||||
tests/unit/browser/test_history.py : +N806
|
|
||||||
tests/helpers/fixtures.py : +N806
|
|
||||||
tests/unit/browser/webkit/http/test_content_disposition.py : +D400
|
|
||||||
scripts/dev/ci/appveyor_install.py : +FI53
|
|
||||||
# FIXME:conf
|
|
||||||
tests/unit/completion/test_models.py : +F821
|
|
||||||
copyright-check = True
|
copyright-check = True
|
||||||
copyright-regexp = # Copyright [\d-]+ .*
|
copyright-regexp = # Copyright [\d-]+ .*
|
||||||
copyright-min-file-size = 110
|
copyright-min-file-size = 110
|
||||||
|
@ -1,23 +1,21 @@
|
|||||||
# This file is automatically generated by scripts/dev/recompile_requirements.py
|
# This file is automatically generated by scripts/dev/recompile_requirements.py
|
||||||
|
|
||||||
flake8==2.6.2 # rq.filter: < 3.0.0
|
flake8==3.5.0
|
||||||
flake8-copyright==0.2.0
|
flake8-copyright==0.2.0
|
||||||
flake8-debugger==3.0.0
|
flake8-debugger==3.0.0
|
||||||
flake8-deprecated==1.2.1 # rq.filter: < 1.3
|
flake8-deprecated==1.3
|
||||||
flake8-docstrings==1.0.3 # rq.filter: < 1.1.0
|
flake8-docstrings==1.0.3 # rq.filter: < 1.1.0
|
||||||
flake8-future-import==0.4.3
|
flake8-future-import==0.4.3
|
||||||
flake8-mock==0.3
|
flake8-mock==0.3
|
||||||
flake8-pep3101==1.0 # rq.filter: < 1.1
|
flake8-pep3101==1.0 # rq.filter: < 1.1
|
||||||
|
flake8-per-file-ignores==0.4
|
||||||
flake8-polyfill==1.0.1
|
flake8-polyfill==1.0.1
|
||||||
flake8-putty==0.4.0
|
|
||||||
flake8-string-format==0.2.3
|
flake8-string-format==0.2.3
|
||||||
flake8-tidy-imports==1.1.0
|
flake8-tidy-imports==1.1.0
|
||||||
flake8-tuple==0.2.13
|
flake8-tuple==0.2.13
|
||||||
mccabe==0.6.1
|
mccabe==0.6.1
|
||||||
packaging==16.8
|
|
||||||
pep8-naming==0.4.1
|
pep8-naming==0.4.1
|
||||||
pycodestyle==2.3.1
|
pycodestyle==2.3.1
|
||||||
pydocstyle==1.1.1 # rq.filter: < 2.0.0
|
pydocstyle==1.1.1 # rq.filter: < 2.0.0
|
||||||
pyflakes==1.6.0
|
pyflakes==1.6.0
|
||||||
pyparsing==2.2.0
|
|
||||||
six==1.11.0
|
six==1.11.0
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
flake8<3.0.0
|
flake8
|
||||||
flake8-copyright
|
flake8-copyright
|
||||||
flake8-debugger
|
flake8-debugger
|
||||||
flake8-deprecated<1.3
|
flake8-deprecated
|
||||||
flake8-docstrings<1.1.0
|
flake8-docstrings<1.1.0
|
||||||
flake8-future-import
|
flake8-future-import
|
||||||
flake8-mock
|
flake8-mock
|
||||||
flake8-pep3101<1.1
|
flake8-pep3101<1.1
|
||||||
flake8-putty
|
flake8-per-file-ignores
|
||||||
flake8-string-format
|
flake8-string-format
|
||||||
flake8-tidy-imports
|
flake8-tidy-imports
|
||||||
flake8-tuple
|
flake8-tuple
|
||||||
@ -14,14 +14,7 @@ pep8-naming
|
|||||||
pydocstyle<2.0.0
|
pydocstyle<2.0.0
|
||||||
pyflakes
|
pyflakes
|
||||||
|
|
||||||
# Pinned to 2.0.0 otherwise
|
|
||||||
pycodestyle==2.3.1
|
|
||||||
# Pinned to 0.5.3 otherwise
|
|
||||||
mccabe==0.6.1
|
|
||||||
|
|
||||||
# Waiting until flake8-putty updated
|
# Waiting until flake8-putty updated
|
||||||
#@ filter: flake8 < 3.0.0
|
|
||||||
#@ filter: pydocstyle < 2.0.0
|
#@ filter: pydocstyle < 2.0.0
|
||||||
#@ filter: flake8-docstrings < 1.1.0
|
#@ filter: flake8-docstrings < 1.1.0
|
||||||
#@ filter: flake8-pep3101 < 1.1
|
#@ filter: flake8-pep3101 < 1.1
|
||||||
#@ filter: flake8-deprecated < 1.3
|
|
||||||
|
@ -91,7 +91,7 @@ class Redirect(Exception):
|
|||||||
self.url = url
|
self.url = url
|
||||||
|
|
||||||
|
|
||||||
class add_handler: # pylint: disable=invalid-name
|
class add_handler: # noqa: N801,N806 pylint: disable=invalid-name
|
||||||
|
|
||||||
"""Decorator to register a qute://* URL handler.
|
"""Decorator to register a qute://* URL handler.
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ class NetworkManager(QNetworkAccessManager):
|
|||||||
|
|
||||||
# No @pyqtSlot here, see
|
# No @pyqtSlot here, see
|
||||||
# https://github.com/qutebrowser/qutebrowser/issues/2213
|
# https://github.com/qutebrowser/qutebrowser/issues/2213
|
||||||
def on_ssl_errors(self, reply, errors): # pragma: no mccabe
|
def on_ssl_errors(self, reply, errors): # noqa: C901 pragma: no mccabe
|
||||||
"""Decide if SSL errors should be ignored or not.
|
"""Decide if SSL errors should be ignored or not.
|
||||||
|
|
||||||
This slot is called on SSL/TLS errors by the self.sslErrors signal.
|
This slot is called on SSL/TLS errors by the self.sslErrors signal.
|
||||||
|
@ -34,7 +34,7 @@ class FixedDataNetworkReply(QNetworkReply):
|
|||||||
|
|
||||||
"""QNetworkReply subclass for fixed data."""
|
"""QNetworkReply subclass for fixed data."""
|
||||||
|
|
||||||
def __init__(self, request, fileData, mimeType, # flake8: disable=N803
|
def __init__(self, request, fileData, mimeType, # noqa: N803
|
||||||
parent=None):
|
parent=None):
|
||||||
"""Constructor.
|
"""Constructor.
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ def check_exclusive(flags, names):
|
|||||||
argstr))
|
argstr))
|
||||||
|
|
||||||
|
|
||||||
class register: # pylint: disable=invalid-name
|
class register: # noqa: N801,N806 pylint: disable=invalid-name
|
||||||
|
|
||||||
"""Decorator to register a new command handler.
|
"""Decorator to register a new command handler.
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ class register: # pylint: disable=invalid-name
|
|||||||
return func
|
return func
|
||||||
|
|
||||||
|
|
||||||
class argument: # pylint: disable=invalid-name
|
class argument: # noqa: N801,N806 pylint: disable=invalid-name
|
||||||
|
|
||||||
"""Decorator to customize an argument for @cmdutils.register.
|
"""Decorator to customize an argument for @cmdutils.register.
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ class Command:
|
|||||||
if isinstance(typ, tuple):
|
if isinstance(typ, tuple):
|
||||||
raise TypeError("{}: Legacy tuple type annotation!".format(
|
raise TypeError("{}: Legacy tuple type annotation!".format(
|
||||||
self.name))
|
self.name))
|
||||||
elif type(typ) is type(typing.Union): # flake8: disable=E721
|
elif type(typ) is type(typing.Union): # noqa: E721
|
||||||
# this is... slightly evil, I know
|
# this is... slightly evil, I know
|
||||||
# We also can't use isinstance here because typing.Union doesn't
|
# We also can't use isinstance here because typing.Union doesn't
|
||||||
# support that.
|
# support that.
|
||||||
|
@ -38,7 +38,7 @@ key_instance = None
|
|||||||
change_filters = []
|
change_filters = []
|
||||||
|
|
||||||
|
|
||||||
class change_filter: # pylint: disable=invalid-name
|
class change_filter: # noqa: N801,N806 pylint: disable=invalid-name
|
||||||
|
|
||||||
"""Decorator to filter calls based on a config section/option matching.
|
"""Decorator to filter calls based on a config section/option matching.
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class NotInModeError(Exception):
|
|||||||
|
|
||||||
def init(win_id, parent):
|
def init(win_id, parent):
|
||||||
"""Initialize the mode manager and the keyparsers for the given win_id."""
|
"""Initialize the mode manager and the keyparsers for the given win_id."""
|
||||||
KM = usertypes.KeyMode # pylint: disable=invalid-name
|
KM = usertypes.KeyMode # noqa: N801,N806 pylint: disable=invalid-name
|
||||||
modeman = ModeManager(win_id, parent)
|
modeman = ModeManager(win_id, parent)
|
||||||
objreg.register('mode-manager', modeman, scope='window', window=win_id)
|
objreg.register('mode-manager', modeman, scope='window', window=win_id)
|
||||||
keyparsers = {
|
keyparsers = {
|
||||||
|
@ -113,7 +113,7 @@ def _generate_stylesheet():
|
|||||||
color: {{ conf.colors.%s }};
|
color: {{ conf.colors.%s }};
|
||||||
background-color: {{ conf.colors.%s }};
|
background-color: {{ conf.colors.%s }};
|
||||||
}
|
}
|
||||||
""" % (flag, flag, flag, # flake8: disable=S001
|
""" % (flag, flag, flag, # noqa: S001
|
||||||
option + '.fg', option + '.bg')
|
option + '.fg', option + '.bg')
|
||||||
return stylesheet
|
return stylesheet
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import bdb
|
import bdb
|
||||||
import pdb # flake8: disable=T002
|
import pdb # noqa: T002
|
||||||
import signal
|
import signal
|
||||||
import functools
|
import functools
|
||||||
import faulthandler
|
import faulthandler
|
||||||
|
@ -55,7 +55,7 @@ class ShellLexer:
|
|||||||
self.token = ''
|
self.token = ''
|
||||||
self.state = ' '
|
self.state = ' '
|
||||||
|
|
||||||
def __iter__(self): # pragma: no mccabe
|
def __iter__(self): # noqa: C901 pragma: no mccabe
|
||||||
"""Read a raw token from the input stream."""
|
"""Read a raw token from the input stream."""
|
||||||
self.reset()
|
self.reset()
|
||||||
for nextchar in self.string:
|
for nextchar in self.string:
|
||||||
|
@ -232,7 +232,7 @@ def format_call(func, args=None, kwargs=None, full=True):
|
|||||||
return '{}({})'.format(name, format_args(args, kwargs))
|
return '{}({})'.format(name, format_args(args, kwargs))
|
||||||
|
|
||||||
|
|
||||||
class log_time: # pylint: disable=invalid-name
|
class log_time: # noqa: N801,N806 pylint: disable=invalid-name
|
||||||
|
|
||||||
"""Log the time an operation takes.
|
"""Log the time an operation takes.
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ def qt_message_handler(msg_type, context, msg):
|
|||||||
# PNGs in Qt with broken color profile
|
# PNGs in Qt with broken color profile
|
||||||
# https://bugreports.qt.io/browse/QTBUG-39788
|
# https://bugreports.qt.io/browse/QTBUG-39788
|
||||||
'libpng warning: iCCP: Not recognizing known sRGB profile that has '
|
'libpng warning: iCCP: Not recognizing known sRGB profile that has '
|
||||||
'been edited', # flake8: disable=E131
|
'been edited', # noqa: E131
|
||||||
'libpng warning: iCCP: known incorrect sRGB profile',
|
'libpng warning: iCCP: known incorrect sRGB profile',
|
||||||
# Hopefully harmless warning
|
# Hopefully harmless warning
|
||||||
'OpenType support missing for script ',
|
'OpenType support missing for script ',
|
||||||
@ -419,7 +419,7 @@ def qt_message_handler(msg_type, context, msg):
|
|||||||
'libpng warning: iCCP: known incorrect sRGB profile',
|
'libpng warning: iCCP: known incorrect sRGB profile',
|
||||||
# https://bugreports.qt.io/browse/QTBUG-47154
|
# https://bugreports.qt.io/browse/QTBUG-47154
|
||||||
'virtual void QSslSocketBackendPrivate::transmit() SSLRead failed '
|
'virtual void QSslSocketBackendPrivate::transmit() SSLRead failed '
|
||||||
'with: -9805', # flake8: disable=E131
|
'with: -9805', # noqa: E131
|
||||||
]
|
]
|
||||||
|
|
||||||
if any(msg.strip().startswith(pattern) for pattern in suppressed_msgs):
|
if any(msg.strip().startswith(pattern) for pattern in suppressed_msgs):
|
||||||
|
@ -584,7 +584,7 @@ def disabled_excepthook():
|
|||||||
sys.excepthook = old_excepthook
|
sys.excepthook = old_excepthook
|
||||||
|
|
||||||
|
|
||||||
class prevent_exceptions: # pylint: disable=invalid-name
|
class prevent_exceptions: # noqa: N801,N806 pylint: disable=invalid-name
|
||||||
|
|
||||||
"""Decorator to ignore and log exceptions.
|
"""Decorator to ignore and log exceptions.
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ pytest.register_assert_rewrite('helpers')
|
|||||||
from helpers import logfail
|
from helpers import logfail
|
||||||
from helpers.logfail import fail_on_logging
|
from helpers.logfail import fail_on_logging
|
||||||
from helpers.messagemock import message_mock
|
from helpers.messagemock import message_mock
|
||||||
from helpers.fixtures import *
|
from helpers.fixtures import * # noqa: F403
|
||||||
from qutebrowser.utils import qtutils, standarddir, usertypes, utils
|
from qutebrowser.utils import qtutils, standarddir, usertypes, utils
|
||||||
from qutebrowser.misc import objects
|
from qutebrowser.misc import objects
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# pylint: disable=invalid-name
|
# noqa: N801,N806 pylint: disable=invalid-name
|
||||||
|
|
||||||
"""pytest fixtures used by the whole testsuite.
|
"""pytest fixtures used by the whole testsuite.
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# pylint: disable=invalid-name,abstract-method
|
# noqa: N801,N806 pylint: disable=invalid-name,abstract-method
|
||||||
|
|
||||||
"""Fake objects/stubs."""
|
"""Fake objects/stubs."""
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ class TestRegister:
|
|||||||
def test_lowercasing(self):
|
def test_lowercasing(self):
|
||||||
"""Make sure the function name is normalized correctly (uppercase)."""
|
"""Make sure the function name is normalized correctly (uppercase)."""
|
||||||
@cmdutils.register()
|
@cmdutils.register()
|
||||||
def Test(): # pylint: disable=invalid-name
|
def Test(): # noqa: N801,N806 pylint: disable=invalid-name
|
||||||
"""Blah."""
|
"""Blah."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -591,7 +591,7 @@ class StyleObj(QObject):
|
|||||||
def __init__(self, stylesheet=None, parent=None):
|
def __init__(self, stylesheet=None, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
if stylesheet is not None:
|
if stylesheet is not None:
|
||||||
self.STYLESHEET = stylesheet # pylint: disable=invalid-name
|
self.STYLESHEET = stylesheet # noqa: N801,N806 pylint: disable=invalid-name
|
||||||
self.rendered_stylesheet = None
|
self.rendered_stylesheet = None
|
||||||
|
|
||||||
def setStyleSheet(self, stylesheet):
|
def setStyleSheet(self, stylesheet):
|
||||||
|
@ -252,8 +252,8 @@ class TestGetAllObjects:
|
|||||||
|
|
||||||
root = QObject()
|
root = QObject()
|
||||||
o1 = self.Object('Object 1', root)
|
o1 = self.Object('Object 1', root)
|
||||||
o2 = self.Object('Object 2', o1) # flake8: disable=F841
|
o2 = self.Object('Object 2', o1) # noqa: F841
|
||||||
o3 = self.Object('Object 3', root) # flake8: disable=F841
|
o3 = self.Object('Object 3', root) # noqa: F841
|
||||||
|
|
||||||
expected = textwrap.dedent("""
|
expected = textwrap.dedent("""
|
||||||
Qt widgets - 2 objects:
|
Qt widgets - 2 objects:
|
||||||
|
Loading…
Reference in New Issue
Block a user