Skip to content

Commit d146b47

Browse files
committed
Disable truthy-iterable by default
1 parent 23d5401 commit d146b47

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

mypy/errorcodes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ def __str__(self) -> str:
164164
"truthy-iterable",
165165
"Warn about Iterable expressions that could always evaluate to true in boolean contexts",
166166
"General",
167+
default_enabled=False,
167168
)
168169
NAME_MATCH: Final = ErrorCode(
169170
"name-match", "Check that type definition has consistent naming", "General"

test-data/unit/check-errorcodes.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ if not f: # E: Function "Callable[[], Any]" could always be true in boolean con
858858
conditional_result = 'foo' if f else 'bar' # E: Function "Callable[[], Any]" could always be true in boolean context [truthy-function]
859859

860860
[case testTruthyIterable]
861-
# flags: --strict-optional
861+
# flags: --strict-optional --enable-error-code truthy-iterable
862862
from typing import Iterable
863863
def func(var: Iterable[str]) -> None:
864864
if var: # E: "var" has type "Iterable[str]" which can always be true in boolean context. Consider using "Collection[str]" instead. [truthy-iterable]

0 commit comments

Comments
 (0)