Skip to content

Commit

Permalink
Disable truthy-iterable by default
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Nov 9, 2022
1 parent 23d5401 commit d146b47
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions mypy/errorcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ def __str__(self) -> str:
"truthy-iterable",
"Warn about Iterable expressions that could always evaluate to true in boolean contexts",
"General",
default_enabled=False,
)
NAME_MATCH: Final = ErrorCode(
"name-match", "Check that type definition has consistent naming", "General"
Expand Down
2 changes: 1 addition & 1 deletion test-data/unit/check-errorcodes.test
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ if not f: # E: Function "Callable[[], Any]" could always be true in boolean con
conditional_result = 'foo' if f else 'bar' # E: Function "Callable[[], Any]" could always be true in boolean context [truthy-function]

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

0 comments on commit d146b47

Please sign in to comment.