Skip to content

Commit 13e6617

Browse files
authored
Move truthy-function docs from “optional checks” to “enabled by default” (#14380)
This error was enabled by default since its introduction (#13686); document it in the correct section. Signed-off-by: Anders Kaseorg <[email protected]>
1 parent e965275 commit 13e6617

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

docs/source/error_code_list.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,19 @@ the provided type.
764764
765765
assert_type([1], list[str]) # Error
766766
767+
Check that function isn't used in boolean context [truthy-function]
768+
-------------------------------------------------------------------
769+
770+
Functions will always evaluate to true in boolean contexts.
771+
772+
.. code-block:: python
773+
774+
def f():
775+
...
776+
777+
if f: # Error: Function "Callable[[], Any]" could always be true in boolean context [truthy-function]
778+
pass
779+
767780
Report syntax errors [syntax]
768781
-----------------------------
769782

docs/source/error_code_list2.rst

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -275,19 +275,6 @@ what the author might have intended. Of course it's possible that ``transform``
275275
and so there is no error in practice. In such case, it is recommended to annotate ``items: Collection[int]``.
276276

277277

278-
Check that function isn't used in boolean context [truthy-function]
279-
-------------------------------------------------------------------
280-
281-
Functions will always evaluate to true in boolean contexts.
282-
283-
.. code-block:: python
284-
285-
def f():
286-
...
287-
288-
if f: # Error: Function "Callable[[], Any]" could always be true in boolean context [truthy-function]
289-
pass
290-
291278
.. _ignore-without-code:
292279

293280
Check that ``# type: ignore`` include an error code [ignore-without-code]

0 commit comments

Comments
 (0)