File tree Expand file tree Collapse file tree 2 files changed +15
-15
lines changed
Expand file tree Collapse file tree 2 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -764,6 +764,21 @@ 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+
780+ .. _ignore-without-code :
781+
767782Report syntax errors [syntax]
768783-----------------------------
769784
Original file line number Diff line number Diff line change @@ -256,21 +256,6 @@ what the author might have intended. Of course it's possible that ``transform``
256256and so there is no error in practice. In such case, it is recommended to annotate ``items: Collection[int] ``.
257257
258258
259- Check that function isn't used in boolean context [truthy-function]
260- -------------------------------------------------------------------
261-
262- Functions will always evaluate to true in boolean contexts.
263-
264- .. code-block :: python
265-
266- def f ():
267- ...
268-
269- if f: # Error: Function "Callable[[], Any]" could always be true in boolean context [truthy-function]
270- pass
271-
272- .. _ignore-without-code :
273-
274259Check that ``# type: ignore `` include an error code [ignore-without-code]
275260-------------------------------------------------------------------------
276261
You can’t perform that action at this time.
0 commit comments