jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/673520 )
Change subject: [tests] Add darglint to flake8 tests ......................................................................
[tests] Add darglint to flake8 tests
Bug: T277396 Change-Id: Ibff1bd68b83b2b4255c8b02e69da0741384b6222 --- M pywikibot/data/api.py M pywikibot/flow.py M pywikibot/proofreadpage.py M pywikibot/textlib.py M setup.py M tox.ini 6 files changed, 13 insertions(+), 7 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py index 021e1c3..bbc6097 100644 --- a/pywikibot/data/api.py +++ b/pywikibot/data/api.py @@ -1430,7 +1430,7 @@
:param params: HTTP request params :param mime_params: HTTP request parts which must be sent in the body - :type mime_params: dict of (content, keytype, headers) + :type mime_params: dict of (content, keytype, headers) # noqa: DAR103 :return: HTTP request headers and body """ # construct a MIME message containing all API key/values diff --git a/pywikibot/flow.py b/pywikibot/flow.py index c99bb4f..855a45e 100644 --- a/pywikibot/flow.py +++ b/pywikibot/flow.py @@ -131,7 +131,7 @@ :param reverse: Whether to reverse the topic ordering. :param include_offset: Whether to include the offset topic. :param toc_only: Whether to only include information for the TOC. - :return: A generator of this board's topics. + :yield: A generator of this board's topics. """ data = self.site.load_topiclist(self, content_format=content_format, limit=limit, sortby=sort_by, diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py index 55b288c..6357816 100644 --- a/pywikibot/proofreadpage.py +++ b/pywikibot/proofreadpage.py @@ -571,7 +571,7 @@ :return: file url of the scan ProofreadPage or None.
:raises Exception: in case of http errors - :raise ImportError: if bs4 is not installed, _bs4_soup() will raise + :raises ImportError: if bs4 is not installed, _bs4_soup() will raise :raises ValueError: in case of no prp_page_image src found for scan """ # wrong link fails with various possible Exceptions. diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index 0b9668e..e02ac96 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -1210,7 +1210,7 @@
:param links: interwiki links to be formatted :type links: dict with the Site objects as keys, and Page - or Link objects as values. + or Link objects as values. # noqa: DAR103 :param insite: site the interwiki links will be formatted for (defaulting to the current site). :type insite: BaseSite @@ -1272,13 +1272,12 @@
def getCategoryLinks(text: str, site=None, include: Optional[List[str]] = None, - expand_text: bool = False) -> list: + expand_text: bool = False) -> List['pywikibot.Category']: """Return a list of category links found in text.
:param include: list of tags which should not be removed by removeDisabledParts() and where CategoryLinks can be searched. :return: all category links found - :rtype: list of Category objects """ result = [] if site is None: diff --git a/setup.py b/setup.py index 3b2c386..c11224f 100644 --- a/setup.py +++ b/setup.py @@ -75,6 +75,7 @@ 'http': ['fake_useragent'], 'flake8': [ # Due to incompatibilities between packages the order matters. 'flake8>=3.9.1', + 'darglint', 'pydocstyle>=4.0.0', 'flake8-bugbear!=21.4.1', 'flake8-coding', diff --git a/tox.ini b/tox.ini index 9c66d78..a6e64be 100644 --- a/tox.ini +++ b/tox.ini @@ -106,11 +106,17 @@ # D412: No blank lines allowed between a section header and its content # D413: Missing blank line after last section
-ignore = B007,C103,D105,D211,D401,D413,D412,FI1,H101,H238,H301,H306,H404,H405,H903,P101,P102,P103,P205,W503 +# DARXXX: Darglint docstring issues to be solved + +ignore = B007,C103,D105,D211,D401,D413,D412,DAR003,DAR101,DAR102,DAR201,DAR202,DAR301,DAR401,DAR402,DAR501,FI1,H101,H238,H301,H306,H404,H405,H903,P101,P102,P103,P205,W503 enable-extensions = H203,H204,H205 exclude = .tox,.git,./*.egg,build,./scripts/i18n/* classmethod-decorators = classmethod,classproperty
+# darglint +strictness=short +docstring_style=sphinx +ignore_regex=:keyword # flake8-coding # note: C103 can be removed from ignore if scripts are cleaned from coding part no-accept-encodings = true
pywikibot-commits@lists.wikimedia.org