False positive 434: toggling a boolean
See original GitHub issueWhat’s wrong
The following code triggers a WPS434 violation warning.
in_code_block = not in_code_block
How it should be
No warning. There’s no better way to toggle a boolean.
Flake8 version and plugins
{
"dependencies": [],
"platform": {
"python_implementation": "CPython",
"python_version": "3.8.12",
"system": "Linux"
},
"plugins": [
{
"is_local": false,
"plugin": "black",
"version": "0.2.3"
},
{
"is_local": false,
"plugin": "flake8-bandit",
"version": "2.1.2"
},
{
"is_local": false,
"plugin": "flake8-bugbear",
"version": "21.9.1"
},
{
"is_local": false,
"plugin": "flake8-comprehensions",
"version": "3.6.1"
},
{
"is_local": false,
"plugin": "flake8-darglint",
"version": "1.8.0"
},
{
"is_local": false,
"plugin": "flake8-docstrings",
"version": "1.6.0, pydocstyle: 6.1.1"
},
{
"is_local": false,
"plugin": "flake8-pytest-style",
"version": "1.5.0"
},
{
"is_local": false,
"plugin": "flake8-string-format",
"version": "0.3.0"
},
{
"is_local": false,
"plugin": "flake8-tidy-imports",
"version": "4.4.1"
},
{
"is_local": false,
"plugin": "flake8-variables-names",
"version": "0.0.4"
},
{
"is_local": false,
"plugin": "flake8_builtins",
"version": "1.5.2"
},
{
"is_local": false,
"plugin": "mccabe",
"version": "0.6.1"
},
{
"is_local": false,
"plugin": "naming",
"version": "0.12.1"
},
{
"is_local": false,
"plugin": "pycodestyle",
"version": "2.7.0"
},
{
"is_local": false,
"plugin": "pyflakes",
"version": "2.3.1"
},
{
"is_local": false,
"plugin": "wps-light",
"version": "0.15.3"
}
],
"version": "3.9.2"
}
pip information
pip 21.2.4 from /home/pawamoy/.local/lib/python3.8/site-packages/pip (python 3.8)
Not using pip to manage packages.
OS information
GNU/Linux 5.14.6
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
How to toggle a boolean? - Stack Overflow
I was searching after a toggling method that does the same, but which "toggles" an initial value of null or undefined to false...
Read more >How to toggle a boolean using JavaScript ? - GeeksforGeeks
A boolean value can be toggled in JavaScript by using two approaches which are discussed below: Method 1: Using the logical NOT operator: ......
Read more >tslint-microsoft-contrib/CHANGELOG.md at master - GitHub
A set of TSLint rules used on some Microsoft projects. - tslint-microsoft-contrib/CHANGELOG.md at master · microsoft/tslint-microsoft-contrib.
Read more >Boolean Regression - CiteSeerX
Abstract. We take a regression-based approach to the problem of induction, which is the problem of inferring general rules from speci c instances....
Read more >Is there terminology for "true"ing, "false"ing, and toggling a ...
When you really need to talk about a boolean value, you can go with "set/reset", or "set to true" and "set to false"....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I guess it should be fixed somewhere here: https://github.com/wemake-services/wemake-python-styleguide/blob/de7aedbdd8f72f998033c40b8a9fc1f894f7179b/wemake_python_styleguide/visitors/ast/naming/variables.py#L87-L93
I’ll try to do that in the next few days 🙂 Any additional hint appreciated!
It is a boolean indeed!