From 700356943ec524f471854132764865116859d35e Mon Sep 17 00:00:00 2001 From: "Hendry, Adam" Date: Thu, 25 Aug 2022 19:45:05 -0700 Subject: [PATCH 01/11] fix(numpy-param-doc): allow "default" in params NumPy doc style guide permits using `default` in parameter signatures. Fixes: #6211 --- pylint/extensions/_check_docs_utils.py | 5 ++- tests/functional/ext/docparams/docparams.py | 38 +++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/pylint/extensions/_check_docs_utils.py b/pylint/extensions/_check_docs_utils.py index d8f797b6c5..7a220790b8 100644 --- a/pylint/extensions/_check_docs_utils.py +++ b/pylint/extensions/_check_docs_utils.py @@ -730,6 +730,8 @@ class NumpyDocstring(GoogleDocstring): re_default_value = r"""((['"]\w+\s*['"])|(\d+)|(True)|(False)|(None))""" + re_default_param = rf"""default[=: ]{re_default_value}""" + re_param_line = re.compile( rf""" \s* (?P\*{{0,2}}\w+)(\s?(:|\n)) # identifier with potential asterisks @@ -737,7 +739,8 @@ class NumpyDocstring(GoogleDocstring): (?P ( ({GoogleDocstring.re_multiple_type}) # default type declaration - (,\s+optional)? # optional 'optional' indication + (,\s+optional|,\s+{re_default_param})? # optional 'optional' indication + # or default value )? ( {{({re_default_value},?\s*)+}} # set of default values diff --git a/tests/functional/ext/docparams/docparams.py b/tests/functional/ext/docparams/docparams.py index 3798ee3ac2..d7a497969a 100644 --- a/tests/functional/ext/docparams/docparams.py +++ b/tests/functional/ext/docparams/docparams.py @@ -1,4 +1,5 @@ """Fixture for testing missing documentation in docparams.""" +from __future__ import annotations def _private_func1( # [missing-return-doc, missing-return-type-doc, missing-any-param-doc] @@ -102,3 +103,40 @@ def params_are_documented(par1: int, *, par2: int) -> int: """ return par1 + par2 + + +def params_with_pipe(arg1: int | bool, arg2: str | None = None) -> None: + """No errors raised when pipe symbol used for or. + + `PEP 604`_ allows writing Union types as X | Y. Can be enabled in Python <3.10 + using `from __future__ import annotations`. + + Parameters + ---------- + arg1 : int | bool + The first arg + arg2 : str | None, default=None + The second arg + + .. _`PEP 604`: + https://peps.python.org/pep-0604/ + """ + + print(arg1, arg2) + + +def regression_6211(x: int = 0) -> None: + """This is a regression test for issue #6211. + + False negative of "missing param doc" was being issued when "default" used in + NumPy-style docs. This test should return no errors. + + See https://github.com/PyCQA/pylint/issues/6211 + + Parameter + --------- + x : int, default 0 + The x parameter + """ + + print(x) From 5d56f103d856eb2571e852ca88abb62d28ba2985 Mon Sep 17 00:00:00 2001 From: "Hendry, Adam" Date: Fri, 26 Aug 2022 09:53:00 -0700 Subject: [PATCH 02/11] fix(formal-param): Change `x` to `number` Change `x` to `number` in test method `regression_6211`. This was causing an `invalid-name` error. --- tests/functional/ext/docparams/docparams.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/functional/ext/docparams/docparams.py b/tests/functional/ext/docparams/docparams.py index d7a497969a..765e148ef5 100644 --- a/tests/functional/ext/docparams/docparams.py +++ b/tests/functional/ext/docparams/docparams.py @@ -125,7 +125,7 @@ def params_with_pipe(arg1: int | bool, arg2: str | None = None) -> None: print(arg1, arg2) -def regression_6211(x: int = 0) -> None: +def regression_6211(number: int = 0) -> None: """This is a regression test for issue #6211. False negative of "missing param doc" was being issued when "default" used in @@ -135,8 +135,8 @@ def regression_6211(x: int = 0) -> None: Parameter --------- - x : int, default 0 - The x parameter + number : int, default 0 + The number parameter """ - print(x) + print(number) From 81ad7d808a3469f888f138d5aa5a72fc2d471da1 Mon Sep 17 00:00:00 2001 From: "Hendry, Adam" Date: Fri, 26 Aug 2022 12:32:45 -0700 Subject: [PATCH 03/11] feat(news): add towncrier fragment Adds a news fragment for the issue. --- doc/whatsnew/2/2.15/index.rst | 6 ++++++ doc/whatsnew/fragments/7360.false_negative | 1 + 2 files changed, 7 insertions(+) create mode 100644 doc/whatsnew/fragments/7360.false_negative diff --git a/doc/whatsnew/2/2.15/index.rst b/doc/whatsnew/2/2.15/index.rst index 420258c5ab..e810d8171a 100644 --- a/doc/whatsnew/2/2.15/index.rst +++ b/doc/whatsnew/2/2.15/index.rst @@ -29,6 +29,12 @@ Marc Byrne became a maintainer, welcome to the team ! .. towncrier release notes start +======= +What's new in Pylint 2.15.0? +---------------------------- +Release date: 2022-08-26 + + New Checks ---------- diff --git a/doc/whatsnew/fragments/7360.false_negative b/doc/whatsnew/fragments/7360.false_negative new file mode 100644 index 0000000000..ed00922a62 --- /dev/null +++ b/doc/whatsnew/fragments/7360.false_negative @@ -0,0 +1 @@ +Add your info here \ No newline at end of file From 1f26b8b09318d7b0e61e68a7c5fee1a9db83094c Mon Sep 17 00:00:00 2001 From: "Hendry, Adam" Date: Fri, 26 Aug 2022 12:51:48 -0700 Subject: [PATCH 04/11] fix(news): correct fragment to #6211 Fix was for issue #6211. The PR that fixes this is #7360. See #6211 --- doc/whatsnew/2/2.15/index.rst | 165 +++++++++++++++++++++ doc/whatsnew/fragments/6211.false_negative | 4 + doc/whatsnew/fragments/7360.false_negative | 1 - 3 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 doc/whatsnew/fragments/6211.false_negative delete mode 100644 doc/whatsnew/fragments/7360.false_negative diff --git a/doc/whatsnew/2/2.15/index.rst b/doc/whatsnew/2/2.15/index.rst index e810d8171a..303e53da4e 100644 --- a/doc/whatsnew/2/2.15/index.rst +++ b/doc/whatsnew/2/2.15/index.rst @@ -84,6 +84,171 @@ False Positives Fixed Refs #7322 (`#7322 `_`) +False Negatives Fixed +--------------------- + +- Emit ``used-before-assignment`` when relying on a name that is reimported later in a function. + + Closes #4624 (`#4624 `_) +- Emit ``used-before-assignment`` for self-referencing named expressions (``:=``) lacking + prior assignments. + + Closes #5653 (`#5653 `_) +- Using "default" in parameter signatures of NumPy doctrings emitted a `missing-param` + error. + + Closes #6211 (`#6211 `_) +- Emit ``used-before-assignment`` for self-referencing assignments under if conditions. + + Closes #6643 (`#6643 `_) +- Emit ``modified-iterating-list`` and analogous messages for dicts and sets when iterating + literals, or when using the ``del`` keyword. + + Closes #6648 (`#6648 `_) +- Emit ``used-before-assignment`` when calling nested functions before assignment. + + Closes #6812 (`#6812 `_) +- Emit ``nonlocal-without-binding`` when a nonlocal name has been assigned at a later point in the same scope. + + Closes #6883 (`#6883 `_) +- Emit ``using-constant-test`` when testing the truth value of a variable or call result + holding a generator. + + Closes #6909 (`#6909 `_) +- Rename ``unhashable-dict-key`` to ``unhashable-member`` and emit when creating sets and dicts, + not just when accessing dicts. + + Closes #7034, Closes #7055 (`#7034 `_) + + +Other Bug Fixes +--------------- + +- Fix a failure to lint packages with ``__init__.py`` contained in directories lacking ``__init__.py``. + + Closes #1667 (`#1667 `_) +- Fixed a syntax-error crash that was not handled properly when the declared encoding of a file + was ``utf-9``. + + Closes #3860 (`#3860 `_) +- Fix a crash in the ``not-callable`` check when there is ambiguity whether an instance is being incorrectly provided to ``__new__()``. + + Closes #7109 (`#7109 `_) +- Fix crash when regex option raises a `re.error` exception. + + Closes #7202 (`#7202 `_) +- Fix `undefined-loop-variable` from walrus in comprehension test. + + Closes #7222 (`#7222 `_) +- Check for `` before removing first item from `sys.path` in `modify_sys_path`. + + Closes #7231 (`#7231 `_) +- Fix sys.path pollution in parallel mode. + + Closes #7246 (`#7246 `_) +- Prevent `useless-parent-delegation` for delegating to a builtin + written in C (e.g. `Exception.__init__`) with non-self arguments. + + Closes #7319 (`#7319 `_) + + +Other Changes +------------- + +- ``bad-exception-context`` has been renamed to ``bad-exception-cause`` as it is about the cause and not the context. + + Closes #3694 (`#3694 `_) +- The message for ``literal-comparison`` is now more explicit about the problem and the + solution. + + Closes #5237 (`#5237 `_) +- ``useless-super-delegation`` has been renamed to ``useless-parent-delegation`` in order to be more generic. + + Closes #6953 (`#6953 `_) +- Pylint now uses ``towncrier`` for changelog generation. + + Refs #6974 (`#6974 `_) +- Update ``astroid`` to 2.12. + + Refs #7153 (`#7153 `_) +- Fix crash when a type-annotated `__slots__` with no value is declared. + + Closes #7280 (`#7280 `_) + + +Internal Changes +---------------- + +- Fixed an issue where it was impossible to update functional tests output when the existing + output was impossible to parse. Instead of raising an error we raise a warning message and + let the functional test fail with a default value. + + Refs #6891 (`#6891 `_) +- ``pylint.testutils.primer`` is now a private API. + + Refs #6905 (`#6905 `_) +- We changed the way we handle the changelog internally by using towncrier. + If you're a contributor you won't have to fix merge conflicts in the + changelog anymore. + + Closes #6974 (`#6974 `_) +- Pylint is now using Scorecards to implement security recommendations from the + `OpenSSF `_. This is done in order to secure our supply chains using a combination + of automated tooling and best practices, most of which were already implemented before. + + Refs #7267 (`#7267 `_) + + +What's new in Pylint 2.15.0? +---------------------------- +Release date: 2022-08-26 + + +New Checks +---------- + +- Added new checker ``missing-timeout`` to warn of default timeout values that could cause + a program to be hanging indefinitely. + + Refs #6780 (`#6780 `_) + + +False Positives Fixed +--------------------- + +- Don't report ``super-init-not-called`` for abstract ``__init__`` methods. + + Closes #3975 (`#3975 `_) +- Don't report ``unsupported-binary-operation`` on Python <= 3.9 when using the ``|`` operator + with types, if one has a metaclass that overloads ``__or__`` or ``__ror__`` as appropriate. + + Closes #4951 (`#4951 `_) +- Don't report ``no-value-for-parameter`` for dataclasses fields annotated with ``KW_ONLY``. + + Closes #5767 (`#5767 `_) +- Fixed inference of ``Enums`` when they are imported under an alias. + + Closes #5776 (`#5776 `_) +- Prevent false positives when accessing ``PurePath.parents`` by index (not slice) on Python 3.10+. + + Closes #5832 (`#5832 `_) +- ``unnecessary-list-index-lookup`` is now more conservative to avoid potential false positives. + + Closes #6896 (`#6896 `_) +- Fix double emitting ``trailing-whitespace`` for multi-line docstrings. + + Closes #6936 (`#6936 `_) +- ``import-error`` now correctly checks for ``contextlib.suppress`` guards on import statements. + + Closes #7270 (`#7270 `_) +- Fix false positive for `no-self-argument`/`no-method-argument` when a staticmethod is applied to a function but uses a different name. + + Closes #7300 (`#7300 `_) +- Fix `undefined-loop-variable` with `break` and `continue` statements in `else` blocks. + + Refs #7311 (`#7311 `_) + + False Negatives Fixed --------------------- diff --git a/doc/whatsnew/fragments/6211.false_negative b/doc/whatsnew/fragments/6211.false_negative new file mode 100644 index 0000000000..b316d29a95 --- /dev/null +++ b/doc/whatsnew/fragments/6211.false_negative @@ -0,0 +1,4 @@ +Using "default" in parameter signatures of NumPy doctrings emitted a `missing-param` +error. + +Closes #6211 \ No newline at end of file diff --git a/doc/whatsnew/fragments/7360.false_negative b/doc/whatsnew/fragments/7360.false_negative deleted file mode 100644 index ed00922a62..0000000000 --- a/doc/whatsnew/fragments/7360.false_negative +++ /dev/null @@ -1 +0,0 @@ -Add your info here \ No newline at end of file From b4731e8765d3f55b1f0f84ab169f9c9020838e6b Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Fri, 26 Aug 2022 10:37:28 +0200 Subject: [PATCH 05/11] Bump pylint to 2.15.0, update changelog (#7355) * Add Marc Byrne to the maintainer team --- doc/whatsnew/2/2.15/index.rst | 165 ---------------------------------- 1 file changed, 165 deletions(-) diff --git a/doc/whatsnew/2/2.15/index.rst b/doc/whatsnew/2/2.15/index.rst index 303e53da4e..e810d8171a 100644 --- a/doc/whatsnew/2/2.15/index.rst +++ b/doc/whatsnew/2/2.15/index.rst @@ -84,171 +84,6 @@ False Positives Fixed Refs #7322 (`#7322 `_`) -False Negatives Fixed ---------------------- - -- Emit ``used-before-assignment`` when relying on a name that is reimported later in a function. - - Closes #4624 (`#4624 `_) -- Emit ``used-before-assignment`` for self-referencing named expressions (``:=``) lacking - prior assignments. - - Closes #5653 (`#5653 `_) -- Using "default" in parameter signatures of NumPy doctrings emitted a `missing-param` - error. - - Closes #6211 (`#6211 `_) -- Emit ``used-before-assignment`` for self-referencing assignments under if conditions. - - Closes #6643 (`#6643 `_) -- Emit ``modified-iterating-list`` and analogous messages for dicts and sets when iterating - literals, or when using the ``del`` keyword. - - Closes #6648 (`#6648 `_) -- Emit ``used-before-assignment`` when calling nested functions before assignment. - - Closes #6812 (`#6812 `_) -- Emit ``nonlocal-without-binding`` when a nonlocal name has been assigned at a later point in the same scope. - - Closes #6883 (`#6883 `_) -- Emit ``using-constant-test`` when testing the truth value of a variable or call result - holding a generator. - - Closes #6909 (`#6909 `_) -- Rename ``unhashable-dict-key`` to ``unhashable-member`` and emit when creating sets and dicts, - not just when accessing dicts. - - Closes #7034, Closes #7055 (`#7034 `_) - - -Other Bug Fixes ---------------- - -- Fix a failure to lint packages with ``__init__.py`` contained in directories lacking ``__init__.py``. - - Closes #1667 (`#1667 `_) -- Fixed a syntax-error crash that was not handled properly when the declared encoding of a file - was ``utf-9``. - - Closes #3860 (`#3860 `_) -- Fix a crash in the ``not-callable`` check when there is ambiguity whether an instance is being incorrectly provided to ``__new__()``. - - Closes #7109 (`#7109 `_) -- Fix crash when regex option raises a `re.error` exception. - - Closes #7202 (`#7202 `_) -- Fix `undefined-loop-variable` from walrus in comprehension test. - - Closes #7222 (`#7222 `_) -- Check for `` before removing first item from `sys.path` in `modify_sys_path`. - - Closes #7231 (`#7231 `_) -- Fix sys.path pollution in parallel mode. - - Closes #7246 (`#7246 `_) -- Prevent `useless-parent-delegation` for delegating to a builtin - written in C (e.g. `Exception.__init__`) with non-self arguments. - - Closes #7319 (`#7319 `_) - - -Other Changes -------------- - -- ``bad-exception-context`` has been renamed to ``bad-exception-cause`` as it is about the cause and not the context. - - Closes #3694 (`#3694 `_) -- The message for ``literal-comparison`` is now more explicit about the problem and the - solution. - - Closes #5237 (`#5237 `_) -- ``useless-super-delegation`` has been renamed to ``useless-parent-delegation`` in order to be more generic. - - Closes #6953 (`#6953 `_) -- Pylint now uses ``towncrier`` for changelog generation. - - Refs #6974 (`#6974 `_) -- Update ``astroid`` to 2.12. - - Refs #7153 (`#7153 `_) -- Fix crash when a type-annotated `__slots__` with no value is declared. - - Closes #7280 (`#7280 `_) - - -Internal Changes ----------------- - -- Fixed an issue where it was impossible to update functional tests output when the existing - output was impossible to parse. Instead of raising an error we raise a warning message and - let the functional test fail with a default value. - - Refs #6891 (`#6891 `_) -- ``pylint.testutils.primer`` is now a private API. - - Refs #6905 (`#6905 `_) -- We changed the way we handle the changelog internally by using towncrier. - If you're a contributor you won't have to fix merge conflicts in the - changelog anymore. - - Closes #6974 (`#6974 `_) -- Pylint is now using Scorecards to implement security recommendations from the - `OpenSSF `_. This is done in order to secure our supply chains using a combination - of automated tooling and best practices, most of which were already implemented before. - - Refs #7267 (`#7267 `_) - - -What's new in Pylint 2.15.0? ----------------------------- -Release date: 2022-08-26 - - -New Checks ----------- - -- Added new checker ``missing-timeout`` to warn of default timeout values that could cause - a program to be hanging indefinitely. - - Refs #6780 (`#6780 `_) - - -False Positives Fixed ---------------------- - -- Don't report ``super-init-not-called`` for abstract ``__init__`` methods. - - Closes #3975 (`#3975 `_) -- Don't report ``unsupported-binary-operation`` on Python <= 3.9 when using the ``|`` operator - with types, if one has a metaclass that overloads ``__or__`` or ``__ror__`` as appropriate. - - Closes #4951 (`#4951 `_) -- Don't report ``no-value-for-parameter`` for dataclasses fields annotated with ``KW_ONLY``. - - Closes #5767 (`#5767 `_) -- Fixed inference of ``Enums`` when they are imported under an alias. - - Closes #5776 (`#5776 `_) -- Prevent false positives when accessing ``PurePath.parents`` by index (not slice) on Python 3.10+. - - Closes #5832 (`#5832 `_) -- ``unnecessary-list-index-lookup`` is now more conservative to avoid potential false positives. - - Closes #6896 (`#6896 `_) -- Fix double emitting ``trailing-whitespace`` for multi-line docstrings. - - Closes #6936 (`#6936 `_) -- ``import-error`` now correctly checks for ``contextlib.suppress`` guards on import statements. - - Closes #7270 (`#7270 `_) -- Fix false positive for `no-self-argument`/`no-method-argument` when a staticmethod is applied to a function but uses a different name. - - Closes #7300 (`#7300 `_) -- Fix `undefined-loop-variable` with `break` and `continue` statements in `else` blocks. - - Refs #7311 (`#7311 `_) - - False Negatives Fixed --------------------- From da7e87a96d251c7364f74df81fe3789ffde92afe Mon Sep 17 00:00:00 2001 From: "Hendry, Adam" Date: Fri, 26 Aug 2022 12:32:45 -0700 Subject: [PATCH 06/11] feat(news): add towncrier fragment Adds a news fragment for the issue. --- doc/whatsnew/2/2.15/index.rst | 1 - doc/whatsnew/fragments/7360.false_negative | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 doc/whatsnew/fragments/7360.false_negative diff --git a/doc/whatsnew/2/2.15/index.rst b/doc/whatsnew/2/2.15/index.rst index e810d8171a..b90c696348 100644 --- a/doc/whatsnew/2/2.15/index.rst +++ b/doc/whatsnew/2/2.15/index.rst @@ -34,7 +34,6 @@ What's new in Pylint 2.15.0? ---------------------------- Release date: 2022-08-26 - New Checks ---------- diff --git a/doc/whatsnew/fragments/7360.false_negative b/doc/whatsnew/fragments/7360.false_negative new file mode 100644 index 0000000000..ed00922a62 --- /dev/null +++ b/doc/whatsnew/fragments/7360.false_negative @@ -0,0 +1 @@ +Add your info here \ No newline at end of file From 4ccad0d43e7425a96fe4237f670542dd3f3b72eb Mon Sep 17 00:00:00 2001 From: "Hendry, Adam" Date: Fri, 26 Aug 2022 21:48:39 -0700 Subject: [PATCH 07/11] fix(regex): fix `re_only_desc` and add lookaheads The `re_only_desc` regex did not match for white and characters after `\n`, so some description-only lines weren't getting matched. In addition, lookaheads were added to `re_param_line` (i.e. make sure the type group is not followed by a new line (`\n`)). Lastly, named groups (ala Perl regular expressions) were added for slightly improved clarity. The hyperlink in the body of test `regression_6211` was causing problems, so this was moved into a reStructuredText directive. Finally, the added `from __future__ import annotations` moved all lines in `tests/functional/ext/docparams/docparams.py` down one line, so the line numbers in `docparams.txt` were off by 1, causing tests to fail. This was corrected. --- pylint/extensions/_check_docs_utils.py | 1 + tests/functional/ext/docparams/docparams.py | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pylint/extensions/_check_docs_utils.py b/pylint/extensions/_check_docs_utils.py index 7a220790b8..41f23ffe3a 100644 --- a/pylint/extensions/_check_docs_utils.py +++ b/pylint/extensions/_check_docs_utils.py @@ -737,6 +737,7 @@ class NumpyDocstring(GoogleDocstring): \s* (?P\*{{0,2}}\w+)(\s?(:|\n)) # identifier with potential asterisks \s* (?P + (?!=\n) ( ({GoogleDocstring.re_multiple_type}) # default type declaration (,\s+optional|,\s+{re_default_param})? # optional 'optional' indication diff --git a/tests/functional/ext/docparams/docparams.py b/tests/functional/ext/docparams/docparams.py index 765e148ef5..865adc3562 100644 --- a/tests/functional/ext/docparams/docparams.py +++ b/tests/functional/ext/docparams/docparams.py @@ -126,17 +126,18 @@ def params_with_pipe(arg1: int | bool, arg2: str | None = None) -> None: def regression_6211(number: int = 0) -> None: - """This is a regression test for issue #6211. + """This is a regression test for issue `#6211`_. False negative of "missing param doc" was being issued when "default" used in NumPy-style docs. This test should return no errors. - See https://github.com/PyCQA/pylint/issues/6211 - - Parameter - --------- + Parameters + ---------- number : int, default 0 The number parameter + + .. _`#6211`: + https://github.com/PyCQA/pylint/issues/6211 """ print(number) From 8f89ec55fe8b3f7e79e1b79711417016c067817b Mon Sep 17 00:00:00 2001 From: "Hendry, Adam" Date: Sat, 27 Aug 2022 13:11:06 -0700 Subject: [PATCH 08/11] fix(pre-commit): fix pre-commit errors Also remove lookahead from `re_param_line` as tests pass without it. --- doc/whatsnew/fragments/6211.false_negative | 2 +- doc/whatsnew/fragments/7360.false_negative | 1 - pylint/extensions/_check_docs_utils.py | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 doc/whatsnew/fragments/7360.false_negative diff --git a/doc/whatsnew/fragments/6211.false_negative b/doc/whatsnew/fragments/6211.false_negative index b316d29a95..0b45e6efcb 100644 --- a/doc/whatsnew/fragments/6211.false_negative +++ b/doc/whatsnew/fragments/6211.false_negative @@ -1,4 +1,4 @@ Using "default" in parameter signatures of NumPy doctrings emitted a `missing-param` error. -Closes #6211 \ No newline at end of file +Closes #6211 diff --git a/doc/whatsnew/fragments/7360.false_negative b/doc/whatsnew/fragments/7360.false_negative deleted file mode 100644 index ed00922a62..0000000000 --- a/doc/whatsnew/fragments/7360.false_negative +++ /dev/null @@ -1 +0,0 @@ -Add your info here \ No newline at end of file diff --git a/pylint/extensions/_check_docs_utils.py b/pylint/extensions/_check_docs_utils.py index 41f23ffe3a..7a220790b8 100644 --- a/pylint/extensions/_check_docs_utils.py +++ b/pylint/extensions/_check_docs_utils.py @@ -737,7 +737,6 @@ class NumpyDocstring(GoogleDocstring): \s* (?P\*{{0,2}}\w+)(\s?(:|\n)) # identifier with potential asterisks \s* (?P - (?!=\n) ( ({GoogleDocstring.re_multiple_type}) # default type declaration (,\s+optional|,\s+{re_default_param})? # optional 'optional' indication From e0dfe7ed2fe363ead8fb6d922d1c7cd2bd19621d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Sun, 4 Sep 2022 22:12:02 +0200 Subject: [PATCH 09/11] Some fixes --- doc/whatsnew/2/2.15/index.rst | 5 ----- tests/functional/ext/docparams/docparams.py | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/doc/whatsnew/2/2.15/index.rst b/doc/whatsnew/2/2.15/index.rst index b90c696348..420258c5ab 100644 --- a/doc/whatsnew/2/2.15/index.rst +++ b/doc/whatsnew/2/2.15/index.rst @@ -29,11 +29,6 @@ Marc Byrne became a maintainer, welcome to the team ! .. towncrier release notes start -======= -What's new in Pylint 2.15.0? ----------------------------- -Release date: 2022-08-26 - New Checks ---------- diff --git a/tests/functional/ext/docparams/docparams.py b/tests/functional/ext/docparams/docparams.py index 865adc3562..1b9c665d7f 100644 --- a/tests/functional/ext/docparams/docparams.py +++ b/tests/functional/ext/docparams/docparams.py @@ -1,4 +1,5 @@ """Fixture for testing missing documentation in docparams.""" + from __future__ import annotations From a2d7e76c6f17fd22e194805ff624a100b73e0667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Sun, 4 Sep 2022 22:12:47 +0200 Subject: [PATCH 10/11] Fix output --- tests/functional/ext/docparams/docparams.txt | 44 ++++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/functional/ext/docparams/docparams.txt b/tests/functional/ext/docparams/docparams.txt index 2504e2b630..c7ab3803b3 100644 --- a/tests/functional/ext/docparams/docparams.txt +++ b/tests/functional/ext/docparams/docparams.txt @@ -1,22 +1,22 @@ -missing-any-param-doc:4:0:4:18:_private_func1:"Missing any documentation in ""_private_func1""":HIGH -missing-return-doc:4:0:4:18:_private_func1:Missing return documentation:HIGH -missing-return-type-doc:4:0:4:18:_private_func1:Missing return type documentation:HIGH -missing-any-param-doc:11:0:11:18:_private_func2:"Missing any documentation in ""_private_func2""":HIGH -missing-yield-doc:11:0:11:18:_private_func2:Missing yield documentation:HIGH -missing-yield-type-doc:11:0:11:18:_private_func2:Missing yield type documentation:HIGH -missing-any-param-doc:18:0:18:18:_private_func3:"Missing any documentation in ""_private_func3""":HIGH -missing-raises-doc:18:0:18:18:_private_func3:"""Exception"" not documented as being raised":HIGH -missing-any-param-doc:23:0:23:16:public_func1:"Missing any documentation in ""public_func1""":HIGH -missing-any-param-doc:29:0:29:30:_async_private_func1:"Missing any documentation in ""_async_private_func1""":HIGH -missing-return-doc:29:0:29:30:_async_private_func1:Missing return documentation:HIGH -missing-return-type-doc:29:0:29:30:_async_private_func1:Missing return type documentation:HIGH -missing-any-param-doc:37:0:37:30:_async_private_func2:"Missing any documentation in ""_async_private_func2""":HIGH -missing-yield-doc:37:0:37:30:_async_private_func2:Missing yield documentation:HIGH -missing-yield-type-doc:37:0:37:30:_async_private_func2:Missing yield type documentation:HIGH -missing-any-param-doc:44:0:44:30:_async_private_func3:"Missing any documentation in ""_async_private_func3""":HIGH -missing-raises-doc:44:0:44:30:_async_private_func3:"""Exception"" not documented as being raised":HIGH -missing-any-param-doc:49:0:49:28:async_public_func1:"Missing any documentation in ""async_public_func1""":HIGH -differing-param-doc:54:0:54:23:differing_param_doc:"""param"" differing in parameter documentation":HIGH -differing-param-doc:65:0:65:35:differing_param_doc_kwords_only:"""param"" differing in parameter documentation":HIGH -missing-type-doc:76:0:76:20:missing_type_doc:"""par1"" missing in parameter type documentation":HIGH -missing-type-doc:86:0:86:32:missing_type_doc_kwords_only:"""par1"" missing in parameter type documentation":HIGH +missing-any-param-doc:6:0:6:18:_private_func1:"Missing any documentation in ""_private_func1""":HIGH +missing-return-doc:6:0:6:18:_private_func1:Missing return documentation:HIGH +missing-return-type-doc:6:0:6:18:_private_func1:Missing return type documentation:HIGH +missing-any-param-doc:13:0:13:18:_private_func2:"Missing any documentation in ""_private_func2""":HIGH +missing-yield-doc:13:0:13:18:_private_func2:Missing yield documentation:HIGH +missing-yield-type-doc:13:0:13:18:_private_func2:Missing yield type documentation:HIGH +missing-any-param-doc:20:0:20:18:_private_func3:"Missing any documentation in ""_private_func3""":HIGH +missing-raises-doc:20:0:20:18:_private_func3:"""Exception"" not documented as being raised":HIGH +missing-any-param-doc:25:0:25:16:public_func1:"Missing any documentation in ""public_func1""":HIGH +missing-any-param-doc:31:0:31:30:_async_private_func1:"Missing any documentation in ""_async_private_func1""":HIGH +missing-return-doc:31:0:31:30:_async_private_func1:Missing return documentation:HIGH +missing-return-type-doc:31:0:31:30:_async_private_func1:Missing return type documentation:HIGH +missing-any-param-doc:39:0:39:30:_async_private_func2:"Missing any documentation in ""_async_private_func2""":HIGH +missing-yield-doc:39:0:39:30:_async_private_func2:Missing yield documentation:HIGH +missing-yield-type-doc:39:0:39:30:_async_private_func2:Missing yield type documentation:HIGH +missing-any-param-doc:46:0:46:30:_async_private_func3:"Missing any documentation in ""_async_private_func3""":HIGH +missing-raises-doc:46:0:46:30:_async_private_func3:"""Exception"" not documented as being raised":HIGH +missing-any-param-doc:51:0:51:28:async_public_func1:"Missing any documentation in ""async_public_func1""":HIGH +differing-param-doc:56:0:56:23:differing_param_doc:"""param"" differing in parameter documentation":HIGH +differing-param-doc:67:0:67:35:differing_param_doc_kwords_only:"""param"" differing in parameter documentation":HIGH +missing-type-doc:78:0:78:20:missing_type_doc:"""par1"" missing in parameter type documentation":HIGH +missing-type-doc:88:0:88:32:missing_type_doc_kwords_only:"""par1"" missing in parameter type documentation":HIGH From 616554a1223acbff517e9975aa14c94b22ec0fc1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 24 Sep 2023 08:42:18 +0000 Subject: [PATCH 11/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/functional/ext/docparams/docparams.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/functional/ext/docparams/docparams.py b/tests/functional/ext/docparams/docparams.py index a922c01016..4e65286623 100644 --- a/tests/functional/ext/docparams/docparams.py +++ b/tests/functional/ext/docparams/docparams.py @@ -148,4 +148,3 @@ def regression_6211(number: int = 0) -> None: # Only check raise nodes within FunctionDefs raise Exception() -