KotlinIsland / KotlinIsland/basedmypy

Warn when a falsey boolean context is ambigious with `None`

Open
#560 0 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
Python
Stars
202
Forks
6
PR merge metrics
No merged PRs in 30d

Description

```py
a: bool | None
if not a: # error: the type of 'a' contains "None" and could be a mistake to check it in a boolean context
...
```

Not just bools, but anything that could be false.

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests. Start by reproducing the shown `bool | None` example and locating the checker’s handling of boolean contexts; done means it warns when a value that may be `None` is tested for falseyness, including non-boolean falsey types.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.