flake8: Add flake8-putty plugin.

Apply a bit of putty to flake8.
https://pypi.python.org/pypi/flake8-putty/
This commit is contained in:
Florian Bruhin 2016-01-21 22:53:53 +01:00
parent fccde768ed
commit 58fb2826ee
13 changed files with 22 additions and 13 deletions

View File

@ -30,7 +30,8 @@ class FixedDataNetworkReply(QNetworkReply):
"""QNetworkReply subclass for fixed data.""" """QNetworkReply subclass for fixed data."""
def __init__(self, request, fileData, mimeType, parent=None): # noqa def __init__(self, request, fileData, mimeType, # flake8: disable=N803
parent=None):
"""Constructor. """Constructor.
Args: Args:

View File

@ -91,7 +91,7 @@ def check_exclusive(flags, names):
argstr)) argstr))
class register: # noqa # pylint: disable=invalid-name class register: # pylint: disable=invalid-name
"""Decorator to register a new command handler. """Decorator to register a new command handler.

View File

@ -46,7 +46,7 @@ from qutebrowser.utils.usertypes import Completion
UNSET = object() UNSET = object()
class change_filter: # noqa # pylint: disable=invalid-name class change_filter: # 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.

View File

@ -65,7 +65,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 # noqa # pylint: disable=invalid-name KM = usertypes.KeyMode # 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 = {

View File

@ -22,7 +22,7 @@
import os import os
import sys import sys
import bdb import bdb
import pdb # noqa import pdb # flake8: disable=T002
import signal import signal
import functools import functools
import faulthandler import faulthandler

View File

@ -55,7 +55,7 @@ class ShellLexer:
self.token = '' self.token = ''
self.state = ' ' self.state = ' '
def __iter__(self): # noqa def __iter__(self): # pragma: no mccabe
"""Read a raw token from the input stream.""" """Read a raw token from the input stream."""
# pylint: disable=too-many-branches,too-many-statements # pylint: disable=too-many-branches,too-many-statements
self.reset() self.reset()

View File

@ -224,7 +224,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: # noqa pylint: disable=invalid-name class log_time: # pylint: disable=invalid-name
"""Log the time an operation takes. """Log the time an operation takes.

View File

@ -274,7 +274,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', # noqa 'been edited', # flake8: disable=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 ',
@ -312,7 +312,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', # noqa 'with: -9805', # flake8: disable=E131
] ]
# Messages which will trigger an exception immediately # Messages which will trigger an exception immediately

View File

@ -563,7 +563,7 @@ def disabled_excepthook():
sys.excepthook = old_excepthook sys.excepthook = old_excepthook
class prevent_exceptions: # noqa # pylint: disable=invalid-name class prevent_exceptions: # pylint: disable=invalid-name
"""Decorator to ignore and log exceptions. """Decorator to ignore and log exceptions.

View File

@ -10,3 +10,10 @@ exclude = .venv,.hypothesis,.git,__pycache__,resources.py
# N802: function name should be lowercase # N802: function name should be lowercase
ignore = E128,E226,E265,E501,E402,E266,F401,N802 ignore = E128,E226,E265,E501,E402,E266,F401,N802
max-complexity = 12 max-complexity = 12
putty-ignore =
/# pylint: disable=invalid-name/ : +N801,N806
/# pragma: no mccabe/ : +C901
/# flake8: disable=E131/ : +E131
/# flake8: disable=N803/ : +N803
/# flake8: disable=T002/ : +T002
/# flake8: disable=F841/ : +F841

View File

@ -247,8 +247,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) # noqa o2 = self.Object('Object 2', o1) # flake8: disable=F841
o3 = self.Object('Object 3', root) # noqa o3 = self.Object('Object 3', root) # flake8: disable=F841
expected = textwrap.dedent(""" expected = textwrap.dedent("""
Qt widgets - 2 objects: Qt widgets - 2 objects:

View File

@ -44,7 +44,7 @@ def test_name(enum):
def test_unknown(enum): def test_unknown(enum):
"""Test invalid values which should raise an AttributeError.""" """Test invalid values which should raise an AttributeError."""
with pytest.raises(AttributeError): with pytest.raises(AttributeError):
_ = enum.three # noqa _ = enum.three # flake8: disable=F841
def test_start(): def test_start():

View File

@ -155,6 +155,7 @@ deps =
flake8==2.5.1 flake8==2.5.1
flake8-debugger==1.4.0 flake8-debugger==1.4.0
pep8-naming==0.3.3 pep8-naming==0.3.3
flake8-putty==0.2.0
mccabe==0.3.1 mccabe==0.3.1
pep8==1.7.0 pep8==1.7.0
pyflakes==1.0.0 pyflakes==1.0.0