Check pep257 via flake8.

We'll still keep the pydocstyle environment though until flake8-pep257 adds
support for that:

https://github.com/Robpol86/flake8-pep257/issues/6
This commit is contained in:
Florian Bruhin 2016-02-10 19:18:47 +01:00
parent 7f791dfcb8
commit 5311576c34
16 changed files with 44 additions and 31 deletions

View File

@ -23,13 +23,22 @@ exclude = .venv,.hypothesis,.git,__pycache__,resources.py
# P102: docstring does contain unindexed parameters
# P103: other string does contain unindexed parameters
# D001: found assert_ replace it with assertTrue
# D102: Missing docstring in public method (will be handled by others)
# D103: Missing docstring in public function (will be handled by others)
# D104: Missing docstring in public package (will be handled by others)
# D105: Missing docstring in magic method (will be handled by others)
# D209: Blank line before closing """ (removed from PEP257)
# D211: No blank lines allowed before class docstring
# (PEP257 got changed, but let's stick to the old standard)
# D402: First line should not be function's signature (false-positives)
ignore =
E128,E226,E265,E501,E402,E266,
F401,
N802,
L101,L102,L103,L201,L202,L203,L204,L207,L302,
P101,P102,P103,
D001
D001,
D102,D103,D104,D105,D209,D211,D402
max-complexity = 12
putty-ignore =
/# pylint: disable=invalid-name/ : +N801,N806
@ -40,6 +49,9 @@ putty-ignore =
/# flake8: disable=T002/ : +T002
/# flake8: disable=F841/ : +F841
/# flake8: disable=S001/ : +S001
tests/*/*/test_*.py : +D100,D101,D401
tests/*/test_*.py : +D100,D101,D401
tests/unit/browser/http/test_content_disposition.py : +D400
copyright-check = True
copyright-regexp = # Copyright [\d-]+ .*
copyright-min-file-size = 110

View File

@ -19,7 +19,7 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""setuptools installer script for qutebrowser"""
"""setuptools installer script for qutebrowser."""
import os
import os.path

View File

@ -383,10 +383,11 @@ class TestAttachment:
'foo-%41.html')
def test_attwithnamepct(self, header_checker):
"""'attachment', specifying a name parameter of foo-%41.html. (this
test was added to observe the behavior of the (unspecified) treatment
of "name" as synonym for "filename"; see Ned Freed's summary[1] where
this comes from in MIME messages)
"""'attachment', specifying a name parameter of foo-%41.html.
(This test was added to observe the behavior of the (unspecified)
treatment of "name" as synonym for "filename"; see Ned Freed's
summary[1] where this comes from in MIME messages)
Should be treated as extension parameter, therefore almost any behavior
is acceptable.

View File

@ -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/>.
"""Tests for qutebrowser.browser.cache"""
"""Tests for qutebrowser.browser.cache."""
from PyQt5.QtCore import QUrl, QDateTime
from PyQt5.QtNetwork import QNetworkDiskCache, QNetworkCacheMetaData

View File

@ -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/>.
"""Tests for qutebrowser.browser.cookies"""
"""Tests for qutebrowser.browser.cookies."""
from unittest import mock
@ -41,7 +41,8 @@ EXPIRED_COOKIE = b'foo4=bar; expires=Sat, 01-Jan-2000 08:00:01 GMT'
class LineparserSaveStub(lineparser.BaseLineParser):
"""A stub for LineParser's save()
"""A stub for LineParser's save().
Attributes:
data: The data before the write

View File

@ -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/>.
"""Tests for qutebrowser.browser.pdfjs"""
"""Tests for qutebrowser.browser.pdfjs."""
import textwrap

View File

@ -468,7 +468,7 @@ class TestIsVisibleIframe:
@pytest.fixture
def invalid_objects(self, stubs):
"""Set up the following base situation:
"""Set up the following base situation.
0, 0 300, 0
##############################

View File

@ -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/>.
"""Tests for qutebrowser.completion.models column widths"""
"""Tests for qutebrowser.completion.models column widths."""
import pytest
@ -33,7 +33,7 @@ from qutebrowser.completion.models.urlmodel import UrlCompletionModel
class TestColumnWidths:
"""Tests for the column widths of the completion models"""
"""Tests for the column widths of the completion models."""
CLASSES = [BaseCompletionModel, SettingOptionCompletionModel,
SettingOptionCompletionModel, SettingSectionCompletionModel,
@ -44,10 +44,10 @@ class TestColumnWidths:
@pytest.mark.parametrize("model", CLASSES)
def test_list_size(self, model):
"""Test if there are 3 items in the COLUMN_WIDTHS property"""
"""Test if there are 3 items in the COLUMN_WIDTHS property."""
assert len(model.COLUMN_WIDTHS) == 3
@pytest.mark.parametrize("model", CLASSES)
def test_column_width_sum(self, model):
"""Test if the sum of the widths asserts to 100"""
"""Test if the sum of the widths asserts to 100."""
assert sum(model.COLUMN_WIDTHS) == 100

View File

@ -411,7 +411,7 @@ class TestFlagList:
@pytest.fixture
def klass_valid_none(self):
"""Return a FlagList with valid_values = None"""
"""Return a FlagList with valid_values = None."""
return configtypes.FlagList
@pytest.mark.parametrize('val', ['', 'foo', 'foo,bar', 'foo,'])

View File

@ -331,7 +331,7 @@ class TestCount:
def test_clear_keystring(qtbot, keyparser):
"""Test that the keystring is cleared and the signal is emitted"""
"""Test that the keystring is cleared and the signal is emitted."""
keyparser._keystring = 'test'
with qtbot.waitSignal(keyparser.keystring_updated):
keyparser.clear_keystring()

View File

@ -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/>.
"""Tests for qutebrowser.misc.autoupdate"""
"""Tests for qutebrowser.misc.autoupdate."""
import pytest
from PyQt5.QtCore import QUrl
@ -28,6 +28,7 @@ INVALID_JSON = ['{"invalid": { "json"}', '{"wrong": "keys"}']
class HTTPGetStub(httpclient.HTTPClient):
"""A stub class for HTTPClient.
Attributes:

View File

@ -97,7 +97,7 @@ def test_setitem(hist):
def test_not_browsing_error(hist):
"""Test that next/previtem throws a ValueError"""
"""Test that next/previtem throws a ValueError."""
with pytest.raises(ValueError) as error1:
hist.nextitem()
assert str(error1.value) == "Currently not browsing history"
@ -122,7 +122,7 @@ def test_previtem_single(hist, monkeypatch):
def test_nextitem_previtem_chain(hist):
"""Test a combination of nextitem and previtem statements"""
"""Test a combination of nextitem and previtem statements."""
assert hist.start('f') == 'fifth'
assert hist.previtem() == 'fourth'
assert hist.previtem() == 'first'
@ -130,14 +130,14 @@ def test_nextitem_previtem_chain(hist):
def test_nextitem_index_error(hist):
""""Test nextitem() when _tmphist raises an IndexError"""
""""Test nextitem() when _tmphist raises an IndexError."""
hist.start('f')
with pytest.raises(cmdhistory.HistoryEndReachedError):
hist.nextitem()
def test_previtem_index_error(hist):
""""Test previtem() when _tmphist raises an IndexError"""
""""Test previtem() when _tmphist raises an IndexError."""
hist.start('f')
with pytest.raises(cmdhistory.HistoryEndReachedError):
for _ in range(10):

View File

@ -734,7 +734,7 @@ class TestSendOrListen:
def test_address_in_use_ok(self, qlocalserver_mock, qlocalsocket_mock,
stubs, caplog, args):
"""Test the following scenario:
"""Test the following scenario.
- First call to send_to_running_instance:
-> could not connect (server not found)
@ -770,7 +770,7 @@ class TestSendOrListen:
def test_address_in_use_error(self, qlocalserver_mock, qlocalsocket_mock,
stubs, caplog, args, has_error, exc_name,
exc_msg):
"""Test the following scenario:
"""Test the following scenario.
- First call to send_to_running_instance:
-> could not connect (server not found)

View File

@ -244,7 +244,6 @@ class TestSaveTab:
@pytest.mark.parametrize('factor', [-1.0, 0.0, 1.5])
def test_zoom(self, hist_tester, factor):
"""Test zoom."""
items = [
Item(url=QUrl('http://www.example.com/'), title='Test title',
active=True),

View File

@ -555,7 +555,6 @@ def test_same_domain_invalid_url(url1, url2):
'http://foo.bar/?header=text/pl%C3%A4in'),
])
def test_encoded_url(url, expected):
"""Test encoded_url"""
url = QUrl(url)
assert urlutils.encoded_url(url) == expected
@ -636,8 +635,7 @@ class TestIncDecNumber:
urlutils.incdec_number(QUrl(url), "increment")
def test_number_below_0(self):
"""Test incdec_number with a number that would be below zero
after decrementing."""
"""Test incdec_number with a number <0 after decrementing."""
with pytest.raises(urlutils.IncDecError):
urlutils.incdec_number(QUrl('http://example.com/page_0.html'),
'decrement')
@ -648,14 +646,13 @@ class TestIncDecNumber:
urlutils.incdec_number(QUrl(""), "increment")
def test_wrong_mode(self):
"""Test if incdec_number rejects a wrong parameter for the incdec
argument."""
"""Test if incdec_number rejects a wrong parameter for incdec."""
valid_url = QUrl("http://example.com/0")
with pytest.raises(ValueError):
urlutils.incdec_number(valid_url, "foobar")
def test_wrong_segment(self):
"""Test if incdec_number rejects a wrong segment"""
"""Test if incdec_number rejects a wrong segment."""
with pytest.raises(urlutils.IncDecError):
urlutils.incdec_number(QUrl('http://example.com'),
'increment', segments={'foobar'})

View File

@ -176,6 +176,8 @@ deps =
flake8-deprecated==0.2
flake8-mock==0.2
flake8-pep3101==0.2
flake8-pep257==1.0.5
pep257==0.7.0
commands =
{envpython} -m flake8