Flake8 Boolean Trap
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)
Setup
prerequisites
- python>=3.8
install
$ pip install flake8_boolean_trap
Usage
Just run flake8 as you normally would.
Lint Codes
| Code. | Description |
|---|---|
| FBT001 | Boolean positional arg in function definition |
| FBT002 | Boolean default value in function definition |
| FBT003 | Boolean positional value in function call |
Release files for flake8-boolean-trap 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flake8_boolean_trap-1.0.1.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flake8_boolean_trap-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.0 kB
Release files / flake8_boolean_trap-1.0.1.tar.gz
| Download URL | flake8_boolean_trap-1.0.1.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
603becf640de095fa8ef5e7f8d9945c525ea6913a75df27408be380fd7e0cb3f
|
|
BLAKE2b-256 checksum How to use checksums |
df4f8ba91d20f54227fa791c4a8e52b9c9b8330f1093da1666de16d4fc8621c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.8.17 Linux/5.15.0-1041-azure
|
Release files / flake8_boolean_trap-1.0.1-py3-none-any.whl
| Download URL | flake8_boolean_trap-1.0.1-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8c21b1ce2591028750c7a61760df525361b26ef02bf0e8032082dc7fd0d0f377
|
|
BLAKE2b-256 checksum How to use checksums |
e54a98ecacb66251c8afc8bb9d364995688215f33b451d58be8817b03e4d23b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.8.17 Linux/5.15.0-1041-azure
|