flake8 plugin which forbids boolean positional arguments
Project description
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 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flake8_boolean_trap-1.0.1.tar.gz.
File metadata
- Download URL: flake8_boolean_trap-1.0.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.17 Linux/5.15.0-1041-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
603becf640de095fa8ef5e7f8d9945c525ea6913a75df27408be380fd7e0cb3f
|
|
| MD5 |
13464ad6c0baf7b12ef8e5d549176e36
|
|
| BLAKE2b-256 |
df4f8ba91d20f54227fa791c4a8e52b9c9b8330f1093da1666de16d4fc8621c7
|
File details
Details for the file flake8_boolean_trap-1.0.1-py3-none-any.whl.
File metadata
- Download URL: flake8_boolean_trap-1.0.1-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.17 Linux/5.15.0-1041-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c21b1ce2591028750c7a61760df525361b26ef02bf0e8032082dc7fd0d0f377
|
|
| MD5 |
b471c8373e6f58376a4abfb9bd119c00
|
|
| BLAKE2b-256 |
e54a98ecacb66251c8afc8bb9d364995688215f33b451d58be8817b03e4d23b5
|