diff options
author | Ryan Farley <ryan.farley@gmx.com> | 2017-11-24 09:25:01 -0600 |
---|---|---|
committer | Ryan Farley <ryan.farley@gmx.com> | 2017-11-26 00:16:14 -0600 |
commit | 5ed801911595cc7b485db66196b5fcb9017ec4d9 (patch) | |
tree | e69692575d98be9a376270d256747f20efa6d96f | |
parent | 03a9cbdfb446ba0f5d94fc6def889183fc03184b (diff) | |
download | qutebrowser-5ed801911595cc7b485db66196b5fcb9017ec4d9.tar.gz qutebrowser-5ed801911595cc7b485db66196b5fcb9017ec4d9.zip |
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.
-rw-r--r-- | .flake8 | 18 | ||||
-rw-r--r-- | misc/requirements/requirements-flake8.txt | 8 | ||||
-rw-r--r-- | misc/requirements/requirements-flake8.txt-raw | 13 | ||||
-rw-r--r-- | qutebrowser/browser/qutescheme.py | 2 | ||||
-rw-r--r-- | qutebrowser/browser/webkit/network/networkmanager.py | 2 | ||||
-rw-r--r-- | qutebrowser/browser/webkit/network/networkreply.py | 2 | ||||
-rw-r--r-- | qutebrowser/commands/cmdutils.py | 4 | ||||
-rw-r--r-- | qutebrowser/commands/command.py | 2 | ||||
-rw-r--r-- | qutebrowser/config/config.py | 2 | ||||
-rw-r--r-- | qutebrowser/keyinput/modeman.py | 2 | ||||
-rw-r--r-- | qutebrowser/mainwindow/statusbar/bar.py | 2 | ||||
-rw-r--r-- | qutebrowser/misc/crashsignal.py | 2 | ||||
-rw-r--r-- | qutebrowser/misc/split.py | 2 | ||||
-rw-r--r-- | qutebrowser/utils/debug.py | 2 | ||||
-rw-r--r-- | qutebrowser/utils/log.py | 4 | ||||
-rw-r--r-- | qutebrowser/utils/utils.py | 2 | ||||
-rw-r--r-- | tests/conftest.py | 2 | ||||
-rw-r--r-- | tests/helpers/fixtures.py | 2 | ||||
-rw-r--r-- | tests/helpers/stubs.py | 2 | ||||
-rw-r--r-- | tests/unit/commands/test_cmdutils.py | 2 | ||||
-rw-r--r-- | tests/unit/config/test_config.py | 2 | ||||
-rw-r--r-- | tests/unit/utils/test_debug.py | 4 |
22 files changed, 34 insertions, 49 deletions
@@ -33,18 +33,12 @@ ignore = D102,D103,D104,D105,D209,D211,D402,D403 min-version = 3.4.0 max-complexity = 12 -putty-auto-ignore = True -putty-ignore = - /# pylint: disable=invalid-name/ : +N801,N806 - /# pragma: no mccabe/ : +C901 - tests/*/test_*.py : +D100,D101,D401 - tests/conftest.py : +F403 - 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 +per-file-ignores = + tests/*/test_*.py : D100,D101,D401 + 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 copyright-check = True copyright-regexp = # Copyright [\d-]+ .* copyright-min-file-size = 110 diff --git a/misc/requirements/requirements-flake8.txt b/misc/requirements/requirements-flake8.txt index 053d06ec4..ff33c19e1 100644 --- a/misc/requirements/requirements-flake8.txt +++ b/misc/requirements/requirements-flake8.txt @@ -1,23 +1,21 @@ # 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-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-future-import==0.4.3 flake8-mock==0.3 flake8-pep3101==1.0 # rq.filter: < 1.1 +flake8-per-file-ignores==0.4 flake8-polyfill==1.0.1 -flake8-putty==0.4.0 flake8-string-format==0.2.3 flake8-tidy-imports==1.1.0 flake8-tuple==0.2.13 mccabe==0.6.1 -packaging==16.8 pep8-naming==0.4.1 pycodestyle==2.3.1 pydocstyle==1.1.1 # rq.filter: < 2.0.0 pyflakes==1.6.0 -pyparsing==2.2.0 six==1.11.0 diff --git a/misc/requirements/requirements-flake8.txt-raw b/misc/requirements/requirements-flake8.txt-raw index 7f0b5153a..2baced0d0 100644 --- a/misc/requirements/requirements-flake8.txt-raw +++ b/misc/requirements/requirements-flake8.txt-raw @@ -1,12 +1,12 @@ -flake8<3.0.0 +flake8 flake8-copyright flake8-debugger -flake8-deprecated<1.3 +flake8-deprecated flake8-docstrings<1.1.0 flake8-future-import flake8-mock flake8-pep3101<1.1 -flake8-putty +flake8-per-file-ignores flake8-string-format flake8-tidy-imports flake8-tuple @@ -14,14 +14,7 @@ pep8-naming pydocstyle<2.0.0 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 -#@ filter: flake8 < 3.0.0 #@ filter: pydocstyle < 2.0.0 #@ filter: flake8-docstrings < 1.1.0 #@ filter: flake8-pep3101 < 1.1 -#@ filter: flake8-deprecated < 1.3 diff --git a/qutebrowser/browser/qutescheme.py b/qutebrowser/browser/qutescheme.py index 11dcfe004..3fb6459a5 100644 --- a/qutebrowser/browser/qutescheme.py +++ b/qutebrowser/browser/qutescheme.py @@ -91,7 +91,7 @@ class Redirect(Exception): 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. diff --git a/qutebrowser/browser/webkit/network/networkmanager.py b/qutebrowser/browser/webkit/network/networkmanager.py index beaa690ca..a19687eb1 100644 --- a/qutebrowser/browser/webkit/network/networkmanager.py +++ b/qutebrowser/browser/webkit/network/networkmanager.py @@ -206,7 +206,7 @@ class NetworkManager(QNetworkAccessManager): # No @pyqtSlot here, see # 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. This slot is called on SSL/TLS errors by the self.sslErrors signal. diff --git a/qutebrowser/browser/webkit/network/networkreply.py b/qutebrowser/browser/webkit/network/networkreply.py index a4a4f59ca..22263c96b 100644 --- a/qutebrowser/browser/webkit/network/networkreply.py +++ b/qutebrowser/browser/webkit/network/networkreply.py @@ -34,7 +34,7 @@ class FixedDataNetworkReply(QNetworkReply): """QNetworkReply subclass for fixed data.""" - def __init__(self, request, fileData, mimeType, # flake8: disable=N803 + def __init__(self, request, fileData, mimeType, # noqa: N803 parent=None): """Constructor. diff --git a/qutebrowser/commands/cmdutils.py b/qutebrowser/commands/cmdutils.py index 8111a1dd4..2f7af2f9f 100644 --- a/qutebrowser/commands/cmdutils.py +++ b/qutebrowser/commands/cmdutils.py @@ -61,7 +61,7 @@ def check_exclusive(flags, names): argstr)) -class register: # pylint: disable=invalid-name +class register: # noqa: N801,N806 pylint: disable=invalid-name """Decorator to register a new command handler. @@ -114,7 +114,7 @@ class register: # pylint: disable=invalid-name 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. diff --git a/qutebrowser/commands/command.py b/qutebrowser/commands/command.py index bbc79a0d8..afb6253db 100644 --- a/qutebrowser/commands/command.py +++ b/qutebrowser/commands/command.py @@ -393,7 +393,7 @@ class Command: if isinstance(typ, tuple): raise TypeError("{}: Legacy tuple type annotation!".format( 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 # We also can't use isinstance here because typing.Union doesn't # support that. diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index ff09e2a5b..058f96087 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -38,7 +38,7 @@ key_instance = None 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. diff --git a/qutebrowser/keyinput/modeman.py b/qutebrowser/keyinput/modeman.py index cd35913ad..ad9bd06ee 100644 --- a/qutebrowser/keyinput/modeman.py +++ b/qutebrowser/keyinput/modeman.py @@ -62,7 +62,7 @@ class NotInModeError(Exception): def init(win_id, parent): """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) objreg.register('mode-manager', modeman, scope='window', window=win_id) keyparsers = { diff --git a/qutebrowser/mainwindow/statusbar/bar.py b/qutebrowser/mainwindow/statusbar/bar.py index 61bb35ace..ae7a3954d 100644 --- a/qutebrowser/mainwindow/statusbar/bar.py +++ b/qutebrowser/mainwindow/statusbar/bar.py @@ -113,7 +113,7 @@ def _generate_stylesheet(): color: {{ conf.colors.%s }}; background-color: {{ conf.colors.%s }}; } - """ % (flag, flag, flag, # flake8: disable=S001 + """ % (flag, flag, flag, # noqa: S001 option + '.fg', option + '.bg') return stylesheet diff --git a/qutebrowser/misc/crashsignal.py b/qutebrowser/misc/crashsignal.py index 68c17d93f..60ef2fbad 100644 --- a/qutebrowser/misc/crashsignal.py +++ b/qutebrowser/misc/crashsignal.py @@ -22,7 +22,7 @@ import os import sys import bdb -import pdb # flake8: disable=T002 +import pdb # noqa: T002 import signal import functools import faulthandler diff --git a/qutebrowser/misc/split.py b/qutebrowser/misc/split.py index 045d9fe4b..bdde2b7ee 100644 --- a/qutebrowser/misc/split.py +++ b/qutebrowser/misc/split.py @@ -55,7 +55,7 @@ class ShellLexer: self.token = '' self.state = ' ' - def __iter__(self): # pragma: no mccabe + def __iter__(self): # noqa: C901 pragma: no mccabe """Read a raw token from the input stream.""" self.reset() for nextchar in self.string: diff --git a/qutebrowser/utils/debug.py b/qutebrowser/utils/debug.py index 5da5234a9..2c86e1142 100644 --- a/qutebrowser/utils/debug.py +++ b/qutebrowser/utils/debug.py @@ -232,7 +232,7 @@ def format_call(func, args=None, kwargs=None, full=True): 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. diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py index 0d87a5f7c..b1966d2f7 100644 --- a/qutebrowser/utils/log.py +++ b/qutebrowser/utils/log.py @@ -360,7 +360,7 @@ def qt_message_handler(msg_type, context, msg): # PNGs in Qt with broken color profile # https://bugreports.qt.io/browse/QTBUG-39788 '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', # Hopefully harmless warning 'OpenType support missing for script ', @@ -419,7 +419,7 @@ def qt_message_handler(msg_type, context, msg): 'libpng warning: iCCP: known incorrect sRGB profile', # https://bugreports.qt.io/browse/QTBUG-47154 '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): diff --git a/qutebrowser/utils/utils.py b/qutebrowser/utils/utils.py index f59c9f553..8debc6688 100644 --- a/qutebrowser/utils/utils.py +++ b/qutebrowser/utils/utils.py @@ -584,7 +584,7 @@ def disabled_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. diff --git a/tests/conftest.py b/tests/conftest.py index 9c52f6800..da0bded55 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -35,7 +35,7 @@ pytest.register_assert_rewrite('helpers') from helpers import logfail from helpers.logfail import fail_on_logging 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.misc import objects diff --git a/tests/helpers/fixtures.py b/tests/helpers/fixtures.py index 5cbf01aad..427cdcc0d 100644 --- a/tests/helpers/fixtures.py +++ b/tests/helpers/fixtures.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # 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. diff --git a/tests/helpers/stubs.py b/tests/helpers/stubs.py index 878c9e166..9fc04aba3 100644 --- a/tests/helpers/stubs.py +++ b/tests/helpers/stubs.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # 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.""" diff --git a/tests/unit/commands/test_cmdutils.py b/tests/unit/commands/test_cmdutils.py index e123ce2d2..ca751074d 100644 --- a/tests/unit/commands/test_cmdutils.py +++ b/tests/unit/commands/test_cmdutils.py @@ -103,7 +103,7 @@ class TestRegister: def test_lowercasing(self): """Make sure the function name is normalized correctly (uppercase).""" @cmdutils.register() - def Test(): # pylint: disable=invalid-name + def Test(): # noqa: N801,N806 pylint: disable=invalid-name """Blah.""" pass diff --git a/tests/unit/config/test_config.py b/tests/unit/config/test_config.py index bf1969e8a..32a7a8119 100644 --- a/tests/unit/config/test_config.py +++ b/tests/unit/config/test_config.py @@ -591,7 +591,7 @@ class StyleObj(QObject): def __init__(self, stylesheet=None, parent=None): super().__init__(parent) 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 def setStyleSheet(self, stylesheet): diff --git a/tests/unit/utils/test_debug.py b/tests/unit/utils/test_debug.py index 9b77b9628..e32f564c8 100644 --- a/tests/unit/utils/test_debug.py +++ b/tests/unit/utils/test_debug.py @@ -252,8 +252,8 @@ class TestGetAllObjects: root = QObject() o1 = self.Object('Object 1', root) - o2 = self.Object('Object 2', o1) # flake8: disable=F841 - o3 = self.Object('Object 3', root) # flake8: disable=F841 + o2 = self.Object('Object 2', o1) # noqa: F841 + o3 = self.Object('Object 3', root) # noqa: F841 expected = textwrap.dedent(""" Qt widgets - 2 objects: |