Flake8 Scout Rule
The Scout Rule: Leave Your Code Better Than You Found It
We all strive to be good digital citizens, right? The Scout Rule is a simple idea: always leave your code cleaner than you found it.
But let's face it, dealing with legacy code can be a real pain. It might not follow best practices or have linting rules in place.
Introducing the Flake8 Scout Rule!
This handy tool is like a digital cleanup crew. It works in two steps:
- Finds the Mess: It runs
flake8to identify all the coding mistakes. - Adds a Note: It politely adds a
# noqa: <errors>comment next to each issue, basically saying, "Hey, future developer, this code needs some love."
Why Use It?
- Gentle Introduction to New Linting Rules: It doesn't force you to fix everything at once.
- Teamwork Makes the Dream Work: Your team can gradually clean up the code together.
- Easy to Use: No need to manually annotate files, this formatter is easy and does it for you.
How It Works:
- Configure Flake8: Set up Flake8 with the rules you want to enforce.
- Run the Flake8 Scout Rule Formatter: Let the Flake8 Scout Rule do its magic.
- Collaborate: Agree with your team that whenever someone touches a file with those # noqa comments, they'll take a moment to fix the underlying issues, if it makes sense to do so.
By following this approach, you can gradually improve your codebase, one commit at a time.
How to run
First install flake8 and flake8-scout-rule
pip install flake8 flake8-scout-rule
Then run flake8-scout-rule like this, as a flake8 formatter
flake8 --format=scout .
Note: The formatter is compatible with all valid Flake8 options. It is particularly beneficial to use this formatter with the --select and --ignore Flake8 options.
No prompt option
This option automatically update files with violations without prompting the user to review the violations.
flake8 --format=scout --no-prompt .
License
Free software: MIT License
Credits
This package was created by Zach Attas aka snackattas, but couldn't have been possible without flake8!
Metadata
Release files for flake8-scout-rule 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_scout_rule-1.0.1.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flake8_scout_rule-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.2 kB
Release files / flake8_scout_rule-1.0.1.tar.gz
| Download URL | flake8_scout_rule-1.0.1.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7b921859c5ba5a7f81a95ab926a2c7fb2300d4ac15d61ae9f74fb0555e2bd0a
|
|
BLAKE2b-256 checksum How to use checksums |
927433ca9efa452dc0af9c695d10d700f1d91f50a16de3b6102ff856a3b0ba25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.0 CPython/3.10.12
|
Release files / flake8_scout_rule-1.0.1-py3-none-any.whl
| Download URL | flake8_scout_rule-1.0.1-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9fb896b7324b6030a85353d58211c4b4fcfa04e01bd684c45e829d8c5ba3a6b0
|
|
BLAKE2b-256 checksum How to use checksums |
10d48b13780779cc17353bd195d2284fc94bbaa5dbaee0304c3b998bc2561329
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.0 CPython/3.10.12
|