Flake8 plugin to prohibit chained assignments (e.g., a = b = c)
Project description
flake8-no-chained-assignments
A flake8 plugin that prohibits chained assignments.
Chained assignments (a = b = value) can obscure intent and lead to subtle bugs when mutable objects are involved. This plugin makes them a lint error, encouraging explicit, readable assignments instead.
Error codes
| Code | Description |
|---|---|
| NCA001 | Chained assignments are prohibited |
Example
# Bad — triggers NCA001
a = b = 0
x = y = z = []
# Good
a = 0
b = 0
Installation
pip install flake8-no-chained-assignments
Or add it to your project's dev dependencies:
pip install -e ".[dev]"
Usage
Once installed, flake8 picks up the plugin automatically:
flake8 your_code.py
Example output:
your_code.py:3:1: NCA001 Chained assignments are prohibited
Configuration
You can ignore the rule per-line with the standard flake8 mechanism:
a = b = 0 # noqa: NCA001
Or disable it project-wide in setup.cfg / .flake8:
[flake8]
extend-ignore = NCA001
Development
git clone https://github.com/mrsndmn/flake8-no-model-forward-call
cd flake8-no-model-forward-call
pip install -e ".[dev]"
pytest tests/ -v
License
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_no_chained_assignments-0.1.1.tar.gz.
File metadata
- Download URL: flake8_no_chained_assignments-0.1.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e68e94039c0ff5bc901a9b085395addc52833b1f1d84ae319d2a4fc865d92deb
|
|
| MD5 |
a0d8b1f898388cc717baada408bfed11
|
|
| BLAKE2b-256 |
2191268536140a92c89a33c221b09e9b9a08cfbd5705e1f0dc5348094a9e22d1
|
File details
Details for the file flake8_no_chained_assignments-0.1.1-py3-none-any.whl.
File metadata
- Download URL: flake8_no_chained_assignments-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0a3c01af5e2e61e3ae253318f0ee1834eb3e5c3d7fa5be8d8f871a67aa6ec05
|
|
| MD5 |
ea9c98518762acc5e027bbb276d2527d
|
|
| BLAKE2b-256 |
a6712fd27d8f3c9e62404c3408ad901dac32d7b825e263c77d7dd5f235c2e57e
|