From 8d6f885b22abad2f73058dec88ed664c6fb1cc3f Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Thu, 10 Nov 2022 17:43:00 -0800 Subject: [PATCH 1/3] Update --no-warn-no-return docs for empty body changes Fixes #13729 --- docs/source/command_line.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/source/command_line.rst b/docs/source/command_line.rst index 83d2983472be..5cd72bc3db20 100644 --- a/docs/source/command_line.rst +++ b/docs/source/command_line.rst @@ -448,9 +448,10 @@ potentially problematic or redundant in some way. are when: - The function has a ``None`` or ``Any`` return type - - The function has an empty body or a body that is just - ellipsis (``...``). Empty functions are often used for - abstract methods. + - The function has an empty body and is marked as an abstractmethod, + is in a protocol class, or is in a stub file + - For unreachable execution paths, for example, if an exception + is always raised Passing in :option:`--no-warn-no-return` will disable these error messages in all cases. From 266bec2e11fe0fecaccd4d91b9d5e6ad0e69dd6b Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Thu, 10 Nov 2022 23:02:21 -0800 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Jelle Zijlstra --- docs/source/command_line.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/command_line.rst b/docs/source/command_line.rst index 5cd72bc3db20..6fae34322d99 100644 --- a/docs/source/command_line.rst +++ b/docs/source/command_line.rst @@ -448,9 +448,9 @@ potentially problematic or redundant in some way. are when: - The function has a ``None`` or ``Any`` return type - - The function has an empty body and is marked as an abstractmethod, + - The function has an empty body and is marked as an abstract method, is in a protocol class, or is in a stub file - - For unreachable execution paths, for example, if an exception + - The execution path is unreachable; for example, if an exception is always raised Passing in :option:`--no-warn-no-return` will disable these error From 7cb3116b89e9179f33efb37bc7e50d419433c016 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Thu, 10 Nov 2022 23:03:54 -0800 Subject: [PATCH 3/3] Update docs/source/command_line.rst --- docs/source/command_line.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/command_line.rst b/docs/source/command_line.rst index 6fae34322d99..31d23db204eb 100644 --- a/docs/source/command_line.rst +++ b/docs/source/command_line.rst @@ -450,7 +450,7 @@ potentially problematic or redundant in some way. - The function has a ``None`` or ``Any`` return type - The function has an empty body and is marked as an abstract method, is in a protocol class, or is in a stub file - - The execution path is unreachable; for example, if an exception + - The execution path can never return; for example, if an exception is always raised Passing in :option:`--no-warn-no-return` will disable these error