A flake8 plugin to detect boolean traps.
docs available at readthedocs
“The Boolean Trap” is a programming anti-pattern where a boolean argument switches behaviour, leading to confusion.
To learn more about the impact it can have on your code and how to prevent it, you can refer to the following resources:
- What is a boolean trap? (YouTube video)
- Python Type Hints - How to Avoid “The Boolean Trap” (article)
- python>=3.8
$ pip install flake8_boolean_trap
Just run flake8
as you normally would.
Code. | Description |
---|---|
FBT001 | Boolean positional arg in function definition |
FBT002 | Boolean default value in function definition |
FBT003 | Boolean positional value in function call |