Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move truthy-function docs from “optional checks” to “enabled by default” #14380

Merged
merged 1 commit into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/source/error_code_list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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]
-----------------------------

Expand Down
13 changes: 0 additions & 13 deletions docs/source/error_code_list2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down