From f3baa916fd15f2992a4a15df424339c944f7e829 Mon Sep 17 00:00:00 2001
From: Mark Byrne <mark.byrne@rabobank.com>
Date: Tue, 29 Mar 2022 20:32:03 +0200
Subject: [PATCH 1/3] * Fix false positive for the ``unnecessary-ellipsis``
 checker when an ellipsis is used in a lambda expression.

  Closes #6036
---
 ChangeLog                                              | 4 ++++
 pylint/checkers/ellipsis_checker.py                    | 2 +-
 tests/functional/u/unnecessary/unnecessary_ellipsis.py | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 9214b58b17..be07b96827 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -41,6 +41,10 @@ Release date: TBA
 
   Closes #6028
 
+* Fix false positive for the ``unnecessary-ellipsis`` checker when an ellipsis is used in a lambda expression.
+
+  Closes #6036
+
 
 What's New in Pylint 2.13.3?
 ============================
diff --git a/pylint/checkers/ellipsis_checker.py b/pylint/checkers/ellipsis_checker.py
index ac5e04095e..136b40886b 100644
--- a/pylint/checkers/ellipsis_checker.py
+++ b/pylint/checkers/ellipsis_checker.py
@@ -43,7 +43,7 @@ def visit_const(self, node: nodes.Const) -> None:
             node.pytype() == "builtins.Ellipsis"
             and not isinstance(
                 node.parent,
-                (nodes.Assign, nodes.AnnAssign, nodes.Call, nodes.Arguments),
+                (nodes.Assign, nodes.AnnAssign, nodes.Call, nodes.Arguments, nodes.Lambda),
             )
             and (
                 len(node.parent.parent.child_sequence(node.parent)) > 1
diff --git a/tests/functional/u/unnecessary/unnecessary_ellipsis.py b/tests/functional/u/unnecessary/unnecessary_ellipsis.py
index 1a6ed777c2..5ed0242064 100644
--- a/tests/functional/u/unnecessary/unnecessary_ellipsis.py
+++ b/tests/functional/u/unnecessary/unnecessary_ellipsis.py
@@ -101,3 +101,6 @@ def __getitem__(self, index: Union[int, slice]) -> Union[int, List[int]]:
 # Ellipsis is allowed as a default argument
 def func_with_ellipsis_default_arg(a = ...) -> None:
     "Some docstring."
+
+# Ignore if the ellipsis is used with a lambda expression
+print("x", lambda: ...)

From c58339371400f8284212795429d8651645f6d463 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
 <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Tue, 29 Mar 2022 18:45:03 +0000
Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
---
 pylint/checkers/ellipsis_checker.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/pylint/checkers/ellipsis_checker.py b/pylint/checkers/ellipsis_checker.py
index 136b40886b..9a6c4a49be 100644
--- a/pylint/checkers/ellipsis_checker.py
+++ b/pylint/checkers/ellipsis_checker.py
@@ -43,7 +43,13 @@ def visit_const(self, node: nodes.Const) -> None:
             node.pytype() == "builtins.Ellipsis"
             and not isinstance(
                 node.parent,
-                (nodes.Assign, nodes.AnnAssign, nodes.Call, nodes.Arguments, nodes.Lambda),
+                (
+                    nodes.Assign,
+                    nodes.AnnAssign,
+                    nodes.Call,
+                    nodes.Arguments,
+                    nodes.Lambda,
+                ),
             )
             and (
                 len(node.parent.parent.child_sequence(node.parent)) > 1

From afb61f74fbcd97f488a62ad995936ccb1b7eced8 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
 <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Wed, 30 Mar 2022 18:05:29 +0000
Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
---
 tests/functional/u/unnecessary/unnecessary_ellipsis.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/functional/u/unnecessary/unnecessary_ellipsis.py b/tests/functional/u/unnecessary/unnecessary_ellipsis.py
index 3bd0a8b44a..3e967b6cd5 100644
--- a/tests/functional/u/unnecessary/unnecessary_ellipsis.py
+++ b/tests/functional/u/unnecessary/unnecessary_ellipsis.py
@@ -113,4 +113,4 @@ def func_with_ellipsis_default_arg(a = ...) -> None:
 mydict3 = {'x': (...,)}
 
 # Ignore if the ellipsis is used with a lambda expression
-print("x", lambda: ...)
\ No newline at end of file
+print("x", lambda: ...)