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

PyPI version Unit Tests codecov PyPI - Downloads GitHub commit activity

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.1.tar.gz (7.1 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.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flake8_scout_rule-1.0.1.tar.gz
  • Upload date:
  • Size: 7.1 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.1.tar.gz
Algorithm Hash digest
SHA256 e7b921859c5ba5a7f81a95ab926a2c7fb2300d4ac15d61ae9f74fb0555e2bd0a
MD5 623372fadb0436084544def9c578619d
BLAKE2b-256 927433ca9efa452dc0af9c695d10d700f1d91f50a16de3b6102ff856a3b0ba25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flake8_scout_rule-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9fb896b7324b6030a85353d58211c4b4fcfa04e01bd684c45e829d8c5ba3a6b0
MD5 1a0b1f2bfc9ba251fc16534bcd428e9d
BLAKE2b-256 10d48b13780779cc17353bd195d2284fc94bbaa5dbaee0304c3b998bc2561329

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