diff options
author | Mark Byrne <31762852+mbyrnepr2@users.noreply.github.com> | 2022-03-30 22:20:36 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2022-03-31 09:44:26 +0200 |
commit | 5ea03af1268ae4776e8ddd9dc55e14f465710288 (patch) | |
tree | e3caa061bb299aa8700dd01c11bae00484342a5f | |
parent | 8b2059047d273ddea0884524ea3c5b99e3d0f59c (diff) | |
download | pylint-git-5ea03af1268ae4776e8ddd9dc55e14f465710288.tar.gz |
Fix false positive for the ``unnecessary-ellipsis`` checker (#6039)
When an ellipsis is used in a lambda expression.
Closes #6036
Co-authored-by: Mark Byrne <mark.byrne@rabobank.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | pylint/checkers/ellipsis_checker.py | 1 | ||||
-rw-r--r-- | tests/functional/u/unnecessary/unnecessary_ellipsis.py | 4 |
3 files changed, 6 insertions, 2 deletions
@@ -24,8 +24,9 @@ Release date: TBA Closes #6028 -* Fix crash for ``unneccessary-ellipsis`` checker when an ellipsis is used inside of a container. +* Fix crash for ``unneccessary-ellipsis`` checker when an ellipsis is used inside of a container or a lambda expression. + Closes #6036 Closes #6037 Closes #6048 diff --git a/pylint/checkers/ellipsis_checker.py b/pylint/checkers/ellipsis_checker.py index 1c7a7bebf..48d43d3b5 100644 --- a/pylint/checkers/ellipsis_checker.py +++ b/pylint/checkers/ellipsis_checker.py @@ -49,6 +49,7 @@ class EllipsisChecker(BaseChecker): nodes.Assign, nodes.BaseContainer, nodes.Call, + nodes.Lambda, ), ) and ( diff --git a/tests/functional/u/unnecessary/unnecessary_ellipsis.py b/tests/functional/u/unnecessary/unnecessary_ellipsis.py index baba0bbc0..3e967b6cd 100644 --- a/tests/functional/u/unnecessary/unnecessary_ellipsis.py +++ b/tests/functional/u/unnecessary/unnecessary_ellipsis.py @@ -102,7 +102,6 @@ class MyIntegerList(List[int]): def func_with_ellipsis_default_arg(a = ...) -> None: "Some docstring." - # Ignore if the ellipsis is inside a container: my_list = [...] my_tuple = (...,) @@ -112,3 +111,6 @@ my_set = {...} mydict1 = {'x': [...]} mydict2 = {'x': {...}} mydict3 = {'x': (...,)} + +# Ignore if the ellipsis is used with a lambda expression +print("x", lambda: ...) |