From 26d308d95d54abf68207d00002c0c1cd3d142ba4 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 3 Dec 2021 13:36:20 +0100 Subject: pylint: Enable docparams checker --- .pylintrc | 5 +++++ qutebrowser/browser/hints.py | 3 +-- qutebrowser/browser/navigate.py | 3 --- qutebrowser/browser/webelem.py | 3 --- qutebrowser/browser/webkit/webview.py | 9 --------- qutebrowser/commands/argparser.py | 2 +- qutebrowser/completion/models/configmodel.py | 2 +- qutebrowser/components/misccommands.py | 3 +++ qutebrowser/config/configcommands.py | 2 +- qutebrowser/mainwindow/tabwidget.py | 1 - qutebrowser/misc/earlyinit.py | 2 +- qutebrowser/misc/miscwidgets.py | 2 +- qutebrowser/misc/sql.py | 3 --- qutebrowser/utils/message.py | 3 ++- qutebrowser/utils/utils.py | 2 +- tests/end2end/fixtures/quteprocess.py | 4 ++-- tests/unit/completion/test_completionwidget.py | 11 +---------- tests/unit/misc/test_keyhints.py | 4 ++-- tests/unit/utils/test_urlutils.py | 1 - tests/unit/utils/test_version.py | 2 +- 20 files changed, 23 insertions(+), 44 deletions(-) diff --git a/.pylintrc b/.pylintrc index 96ed44ea1..a3ac3d82a 100644 --- a/.pylintrc +++ b/.pylintrc @@ -14,6 +14,7 @@ load-plugins=qute_pylint.config, pylint.extensions.docstyle, pylint.extensions.check_elif, pylint.extensions.typing, + pylint.extensions.docparams, persistent=n py-version=3.6 @@ -55,6 +56,10 @@ disable=locally-disabled, raise-missing-from, consider-using-tuple, consider-using-namedtuple-or-dataclass, + missing-raises-doc, + missing-type-doc, + missing-param-doc, + useless-param-doc, [BASIC] function-rgx=[a-z_][a-z0-9_]{2,50}$ diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 64062bbc6..2e4e8e4b4 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -299,7 +299,7 @@ class HintActions: Args: elem: The QWebElement to download. - _context: The HintContext to use. + context: The HintContext to use. """ url = elem.resolve_url(context.baseurl) if url is None: @@ -1154,7 +1154,6 @@ class WordHinter: from the words arg as fallback. Args: - words: Words to use as fallback when no link text can be used. elems: The elements to get hint strings for. Return: diff --git a/qutebrowser/browser/navigate.py b/qutebrowser/browser/navigate.py index 82bf57136..6217c8d00 100644 --- a/qutebrowser/browser/navigate.py +++ b/qutebrowser/browser/navigate.py @@ -92,9 +92,6 @@ def incdec(url, count, inc_or_dec): url: The current url. count: How much to increment or decrement by. inc_or_dec: Either 'increment' or 'decrement'. - tab: Whether to open the link in a new tab. - background: Open the link in a new background tab. - window: Open the link in a new window. """ urlutils.ensure_valid(url) segments: Optional[Set[str]] = ( diff --git a/qutebrowser/browser/webelem.py b/qutebrowser/browser/webelem.py index 7ebc7c69a..7dbd60782 100644 --- a/qutebrowser/browser/webelem.py +++ b/qutebrowser/browser/webelem.py @@ -160,9 +160,6 @@ class AbstractWebElement(collections.abc.MutableMapping): # type: ignore[type-a def is_content_editable(self) -> bool: """Check if an element has a contenteditable attribute. - Args: - elem: The QWebElement to check. - Return: True if the element has a contenteditable attribute, False otherwise. diff --git a/qutebrowser/browser/webkit/webview.py b/qutebrowser/browser/webkit/webview.py index 0242bed0c..289e29920 100644 --- a/qutebrowser/browser/webkit/webview.py +++ b/qutebrowser/browser/webkit/webview.py @@ -152,9 +152,6 @@ class WebView(QWebView): Args: e: The QPaintEvent. - - Return: - The superclass event return value. """ frame = self.page().mainFrame() new_pos = (frame.scrollBarValue(Qt.Horizontal), @@ -186,9 +183,6 @@ class WebView(QWebView): Args: e: The QShowEvent. - - Return: - The superclass event return value. """ super().showEvent(e) self.page().setVisibilityState(QWebPage.VisibilityStateVisible) @@ -198,9 +192,6 @@ class WebView(QWebView): Args: e: The QHideEvent. - - Return: - The superclass event return value. """ super().hideEvent(e) self.page().setVisibilityState(QWebPage.VisibilityStateHidden) diff --git a/qutebrowser/commands/argparser.py b/qutebrowser/commands/argparser.py index f8f083b72..2a11589f9 100644 --- a/qutebrowser/commands/argparser.py +++ b/qutebrowser/commands/argparser.py @@ -101,7 +101,7 @@ def type_conv(param, typ, value, *, str_choices=None): Args: param: The argparse.Parameter we're checking - types: The allowed type + typ: The allowed type value: The value to convert str_choices: The allowed choices if the type ends up being a string diff --git a/qutebrowser/completion/models/configmodel.py b/qutebrowser/completion/models/configmodel.py index 736d09644..abd0a817d 100644 --- a/qutebrowser/completion/models/configmodel.py +++ b/qutebrowser/completion/models/configmodel.py @@ -78,7 +78,7 @@ def value(optname, *values, info): Args: optname: The name of the config option this model shows. - values: The values already provided on the command line. + *values: The values already provided on the command line. info: A CompletionInfo instance. """ model = completionmodel.CompletionModel(column_widths=(30, 70, 0)) diff --git a/qutebrowser/components/misccommands.py b/qutebrowser/components/misccommands.py index 8eaae045f..fe908b7d2 100644 --- a/qutebrowser/components/misccommands.py +++ b/qutebrowser/components/misccommands.py @@ -17,6 +17,9 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . +# To allow count being documented +# pylint: disable=differing-param-doc + """Various commands.""" import os diff --git a/qutebrowser/config/configcommands.py b/qutebrowser/config/configcommands.py index 62fc87f81..417ffce00 100644 --- a/qutebrowser/config/configcommands.py +++ b/qutebrowser/config/configcommands.py @@ -204,7 +204,7 @@ class ConfigCommands: Args: option: The name of the option. - values: The values to cycle through. + *values: The values to cycle through. pattern: The link:configuring{outfilesuffix}#patterns[URL pattern] to use. temp: Set value temporarily until qutebrowser is closed. print_: Print the value after setting. diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index 7983127d5..07b1e5bef 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -486,7 +486,6 @@ class TabBar(QTabBar): Args: idx: The tab index to get the title for. - handle_unset: Whether to return an empty string on KeyError. """ try: return self.tab_data(idx, 'page-title') diff --git a/qutebrowser/misc/earlyinit.py b/qutebrowser/misc/earlyinit.py index 9dd1dc9a8..034d7ff74 100644 --- a/qutebrowser/misc/earlyinit.py +++ b/qutebrowser/misc/earlyinit.py @@ -109,7 +109,7 @@ def init_faulthandler(fileobj=sys.__stderr__): when sys.stderr got replaced, e.g. by "Python Tools for Visual Studio". Args: - fobj: An opened file object to write the traceback to. + fileobj: An opened file object to write the traceback to. """ try: faulthandler.enable(fileobj) diff --git a/qutebrowser/misc/miscwidgets.py b/qutebrowser/misc/miscwidgets.py index b89288fc7..4354ed2ab 100644 --- a/qutebrowser/misc/miscwidgets.py +++ b/qutebrowser/misc/miscwidgets.py @@ -213,7 +213,7 @@ class _FoldArrow(QWidget): """Paint the arrow. Args: - _paint: The QPaintEvent (unused). + _event: The QPaintEvent (unused). """ opt = QStyleOption() opt.initFrom(self) diff --git a/qutebrowser/misc/sql.py b/qutebrowser/misc/sql.py index 814eb2bb0..8f3282a2f 100644 --- a/qutebrowser/misc/sql.py +++ b/qutebrowser/misc/sql.py @@ -479,9 +479,6 @@ class SqlTable(QObject): Args: field: Field to use as the key. value: Key value to delete. - - Return: - The number of rows deleted. """ q = self.database.query(f"DELETE FROM {self._name} where {field} = :val") q.run(val=value) diff --git a/qutebrowser/utils/message.py b/qutebrowser/utils/message.py index 3097cb4dc..98e7d1c11 100644 --- a/qutebrowser/utils/message.py +++ b/qutebrowser/utils/message.py @@ -18,7 +18,8 @@ # along with qutebrowser. If not, see . # Because every method needs to have a log_stack argument -# pylint: disable=unused-argument +# and because we use *args a lot +# pylint: disable=unused-argument,differing-param-doc """Message singleton so we don't have to define unneeded signals.""" diff --git a/qutebrowser/utils/utils.py b/qutebrowser/utils/utils.py index 75da5028b..9c68932f3 100644 --- a/qutebrowser/utils/utils.py +++ b/qutebrowser/utils/utils.py @@ -382,7 +382,7 @@ def get_repr(obj: Any, constructor: bool = False, **attrs: Any) -> str: obj: The object to get a repr for. constructor: If True, show the Foo(one=1, two=2) form instead of . - attrs: The attributes to add. + **attrs: The attributes to add. """ cls = qualname(obj.__class__) parts = [] diff --git a/tests/end2end/fixtures/quteprocess.py b/tests/end2end/fixtures/quteprocess.py index e165ce5cf..14f34b52c 100644 --- a/tests/end2end/fixtures/quteprocess.py +++ b/tests/end2end/fixtures/quteprocess.py @@ -909,8 +909,8 @@ class QuteProc(testprocess.Process): """Get a screenshot of the current page. Arguments: - probe: If given, only continue if the pixel at the given position isn't - black (or whatever is specified by probe_color). + probe_pos: If given, only continue if the pixel at the given + position isn't black (or whatever is specified by probe_color). """ for _ in range(5): tmp_path = self.request.getfixturevalue('tmp_path') diff --git a/tests/unit/completion/test_completionwidget.py b/tests/unit/completion/test_completionwidget.py index 89390cbf1..9a1bc99dd 100644 --- a/tests/unit/completion/test_completionwidget.py +++ b/tests/unit/completion/test_completionwidget.py @@ -163,16 +163,7 @@ def test_completion_item_focus_no_model(which, completionview, model, qtbot): @pytest.mark.skip("Seems to disagree with reality, see #5897") def test_completion_item_focus_fetch(completionview, model, qtbot): - """Test that on_next_prev_item moves the selection properly. - - Args: - which: the direction in which to move the selection. - tree: Each list represents a completion category, with each string - being an item under that category. - expected: expected argument from on_selection_changed for each - successive movement. None implies no signal should be - emitted. - """ + """Test that on_next_prev_item moves the selection properly.""" cat = mock.Mock(spec=[ 'layoutChanged', 'layoutAboutToBeChanged', 'canFetchMore', 'fetchMore', 'rowCount', 'index', 'data']) diff --git a/tests/unit/misc/test_keyhints.py b/tests/unit/misc/test_keyhints.py index 8d9c53c93..922f39331 100644 --- a/tests/unit/misc/test_keyhints.py +++ b/tests/unit/misc/test_keyhints.py @@ -30,8 +30,8 @@ def expected_text(*args): """Helper to format text we expect the KeyHintView to generate. Args: - args: One tuple for each row in the expected output. - Tuples are of the form: (prefix, color, suffix, command). + *args: One tuple for each row in the expected output. + Tuples are of the form: (prefix, color, suffix, command). """ text = '' for group in args: diff --git a/tests/unit/utils/test_urlutils.py b/tests/unit/utils/test_urlutils.py index 97ff268ca..e5773e25e 100644 --- a/tests/unit/utils/test_urlutils.py +++ b/tests/unit/utils/test_urlutils.py @@ -334,7 +334,6 @@ def test_get_search_url_open_base_url(config_stub, url, host): Args: url: The "URL" to enter. host: The expected search machine host. - query: The expected search query. """ config_stub.val.url.open_base_url = True url = urlutils._get_search_url(url) diff --git a/tests/unit/utils/test_version.py b/tests/unit/utils/test_version.py index 1ffbe3c09..7b616d8b7 100644 --- a/tests/unit/utils/test_version.py +++ b/tests/unit/utils/test_version.py @@ -721,7 +721,7 @@ class TestModuleVersions: Args: attribute: The name of the version attribute. - expected: The expected return value. + expected_modules: The expected modules with that attribute. """ import_fake.version_attribute = attribute -- cgit v1.2.3-54-g00ecf