From b5dd64767846d67161c3c15125c57b2d9951352a Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 26 Nov 2017 19:50:13 +0100 Subject: [PATCH] Upgrade pydocstyle/flake8-docstrings See #3320 --- .flake8 | 6 +++++- misc/requirements/requirements-flake8.txt | 5 +++-- misc/requirements/requirements-flake8.txt-raw | 6 ++---- qutebrowser/browser/qtnetworkdownloads.py | 2 +- qutebrowser/commands/runners.py | 1 - scripts/dev/src2asciidoc.py | 2 +- tests/unit/browser/webkit/http/test_content_disposition.py | 2 +- tests/unit/misc/test_cmdhistory.py | 4 ++-- 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.flake8 b/.flake8 index e29e7037c..61fdc0326 100644 --- a/.flake8 +++ b/.flake8 @@ -19,18 +19,22 @@ exclude = .*,__pycache__,resources.py # 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) +# D106: Missing docstring in public nested class (will be handled by others) +# D107: Missing docstring in __init__ (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) +# D401: First line should be in imperative mood (okay sometimes) # D402: First line should not be function's signature (false-positives) # D403: First word of the first line should be properly capitalized # (false-positives) +# D413: Missing blank line after last section (not in pep257?) ignore = E128,E226,E265,E501,E402,E266,E722,E731, F401, N802, P101,P102,P103, - D102,D103,D104,D105,D209,D211,D402,D403 + D102,D103,D106,D107,D104,D105,D209,D211,D401,D402,D403,D413 min-version = 3.4.0 max-complexity = 12 per-file-ignores = diff --git a/misc/requirements/requirements-flake8.txt b/misc/requirements/requirements-flake8.txt index ff33c19e1..b34ce5b67 100644 --- a/misc/requirements/requirements-flake8.txt +++ b/misc/requirements/requirements-flake8.txt @@ -4,7 +4,7 @@ flake8==3.5.0 flake8-copyright==0.2.0 flake8-debugger==3.0.0 flake8-deprecated==1.3 -flake8-docstrings==1.0.3 # rq.filter: < 1.1.0 +flake8-docstrings==1.1.0 flake8-future-import==0.4.3 flake8-mock==0.3 flake8-pep3101==1.0 # rq.filter: < 1.1 @@ -16,6 +16,7 @@ flake8-tuple==0.2.13 mccabe==0.6.1 pep8-naming==0.4.1 pycodestyle==2.3.1 -pydocstyle==1.1.1 # rq.filter: < 2.0.0 +pydocstyle==2.1.1 pyflakes==1.6.0 six==1.11.0 +snowballstemmer==1.2.1 diff --git a/misc/requirements/requirements-flake8.txt-raw b/misc/requirements/requirements-flake8.txt-raw index 2878edfba..8abcc51c7 100644 --- a/misc/requirements/requirements-flake8.txt-raw +++ b/misc/requirements/requirements-flake8.txt-raw @@ -2,7 +2,7 @@ flake8 flake8-copyright flake8-debugger flake8-deprecated -flake8-docstrings<1.1.0 +flake8-docstrings flake8-future-import flake8-mock flake8-pep3101<1.1 @@ -11,10 +11,8 @@ flake8-string-format flake8-tidy-imports flake8-tuple pep8-naming -pydocstyle<2.0.0 +pydocstyle pyflakes # Not upgraded yet because they introduce new errors -#@ filter: pydocstyle < 2.0.0 -#@ filter: flake8-docstrings < 1.1.0 #@ filter: flake8-pep3101 < 1.1 diff --git a/qutebrowser/browser/qtnetworkdownloads.py b/qutebrowser/browser/qtnetworkdownloads.py index 709c8207b..0e079b633 100644 --- a/qutebrowser/browser/qtnetworkdownloads.py +++ b/qutebrowser/browser/qtnetworkdownloads.py @@ -215,7 +215,7 @@ class DownloadItem(downloads.AbstractDownloadItem): abort_on=[self.cancelled, self.error]) def _set_fileobj(self, fileobj, *, autoclose=True): - """"Set the file object to write the download to. + """Set the file object to write the download to. Args: fileobj: A file-like object. diff --git a/qutebrowser/commands/runners.py b/qutebrowser/commands/runners.py index fadb6c063..095b49108 100644 --- a/qutebrowser/commands/runners.py +++ b/qutebrowser/commands/runners.py @@ -95,7 +95,6 @@ class CommandParser: """Parse qutebrowser commandline commands. Attributes: - _partial_match: Whether to allow partial command matches. """ diff --git a/scripts/dev/src2asciidoc.py b/scripts/dev/src2asciidoc.py index a0ddfb795..1470103ab 100755 --- a/scripts/dev/src2asciidoc.py +++ b/scripts/dev/src2asciidoc.py @@ -386,7 +386,7 @@ def generate_commands(filename): def _generate_setting_backend_info(f, opt): - """"Generate backend information for the given option.""" + """Generate backend information for the given option.""" all_backends = [usertypes.Backend.QtWebKit, usertypes.Backend.QtWebEngine] if opt.raw_backends is not None: for name, conditional in sorted(opt.raw_backends.items()): diff --git a/tests/unit/browser/webkit/http/test_content_disposition.py b/tests/unit/browser/webkit/http/test_content_disposition.py index e1f78eb74..5aa25166e 100644 --- a/tests/unit/browser/webkit/http/test_content_disposition.py +++ b/tests/unit/browser/webkit/http/test_content_disposition.py @@ -581,7 +581,7 @@ class TestAttachment: header_checker.check_ignored('attachment; filename=bar foo=foo') def test_attmissingdelim3(self, header_checker): - """";" missing between disposition type and filename parameter. + """';' missing between disposition type and filename parameter. This is invalid, so UAs should ignore it. """ diff --git a/tests/unit/misc/test_cmdhistory.py b/tests/unit/misc/test_cmdhistory.py index 7858831b6..44c6c2d82 100644 --- a/tests/unit/misc/test_cmdhistory.py +++ b/tests/unit/misc/test_cmdhistory.py @@ -129,14 +129,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):