Skip to content

Commit

Permalink
Move truthy-function docs from “optional checks” to “enabled by defau…
Browse files Browse the repository at this point in the history
…lt” (#14380)

This error was enabled by default since its introduction (#13686);
document it in the correct section.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
andersk authored Jan 11, 2023
1 parent e965275 commit 13e6617
Showing 2 changed files with 13 additions and 13 deletions.
13 changes: 13 additions & 0 deletions docs/source/error_code_list.rst
Original file line number Diff line number Diff line change
@@ -764,6 +764,19 @@ the provided type.
assert_type([1], list[str]) # Error
Check that function isn't used in boolean context [truthy-function]
-------------------------------------------------------------------

Functions will always evaluate to true in boolean contexts.

.. code-block:: python
def f():
...
if f: # Error: Function "Callable[[], Any]" could always be true in boolean context [truthy-function]
pass
Report syntax errors [syntax]
-----------------------------

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


Check that function isn't used in boolean context [truthy-function]
-------------------------------------------------------------------

Functions will always evaluate to true in boolean contexts.

.. code-block:: python
def f():
...
if f: # Error: Function "Callable[[], Any]" could always be true in boolean context [truthy-function]
pass
.. _ignore-without-code:

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

0 comments on commit 13e6617

Please sign in to comment.