Skip to main content

A Flake8 formatter that applies '# noqa: <errors>' annotations to flake8 violations found, helping to incrementally improve code quality.

Project description

Flake8 Scout Rule

codecov Python application lint, test, upload code coverage

sample usage

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:

  1. Finds the Mess: It runs flake8 to identify all the coding mistakes.
  2. 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:

  1. Configure Flake8: Set up Flake8 with the rules you want to enforce.
  2. Run the Flake8 Scout Rule Formatter: Let the Flake8 Scout Rule do its magic.
  3. 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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8_scout_rule-1.0.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flake8_scout_rule-1.0.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file flake8_scout_rule-1.0.0.tar.gz.

File metadata

  • Download URL: flake8_scout_rule-1.0.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.0 CPython/3.10.12

File hashes

Hashes for flake8_scout_rule-1.0.0.tar.gz
Algorithm Hash digest
SHA256 15e7e4964c1c56957b92d643793c9fadf11000351c2dfe4a8155cfffb020f86f
MD5 42f8addaa03f6bb1008e67ed82c954f1
BLAKE2b-256 83fedc960aa576d131755d151364f117e1d0fbd6b952dd2045facb03ec4c8b45

See more details on using hashes here.

File details

Details for the file flake8_scout_rule-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_scout_rule-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ce5ec4dc4edb5f6df38057c295fbbe969e97e19ce7bd4e8390b8820a0ed0b67
MD5 1559c82a5be22e1d1cfa939b1c30dd38
BLAKE2b-256 7a1f06b4404725919ce11d8f96d35a1ee4652264aad39e40d2a1fc3c4b3d04a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page