summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Byrne <31762852+mbyrnepr2@users.noreply.github.com>2022-03-30 22:20:36 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2022-03-31 09:44:26 +0200
commit5ea03af1268ae4776e8ddd9dc55e14f465710288 (patch)
treee3caa061bb299aa8700dd01c11bae00484342a5f
parent8b2059047d273ddea0884524ea3c5b99e3d0f59c (diff)
downloadpylint-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--ChangeLog3
-rw-r--r--pylint/checkers/ellipsis_checker.py1
-rw-r--r--tests/functional/u/unnecessary/unnecessary_ellipsis.py4
3 files changed, 6 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 34ab7bbcf..85b489f4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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: ...)