diff --git a/docs/source/error_code_list.rst b/docs/source/error_code_list.rst index 264badc031075..1a39bf8feb6cb 100644 --- a/docs/source/error_code_list.rst +++ b/docs/source/error_code_list.rst @@ -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] ----------------------------- diff --git a/docs/source/error_code_list2.rst b/docs/source/error_code_list2.rst index 0a2d8a8c5c5cd..986118c4f0da1 100644 --- a/docs/source/error_code_list2.rst +++ b/docs/source/error_code_list2.rst @@ -256,19 +256,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]