Skip to main content

silence linting errors by adding ignore/fixme comments

Project description

silence-lint-error

Silent linting errors by adding ignore or fixme comments.

This tool currently works with:

Usage

Install with pip:

python -m pip install silence-lint-error

You must also install the linting tool you wish to use in the same virtual environment.

silence linting errors

Find linting errors and add the ignore or fixme comments as applicable.

For example, to add lint-fixme: CollapseIsinstanceChecks comments to ignore the fixit.rules:CollapseIsinstanceChecks rule from fixit, run:

silence-lint-error fixit fixit.rules:CollapseIsinstanceChecks path/to/files/ path/to/more/files/

To add noqa: F401 comments to ignore the F401 rule in flake8, run:

silence-lint-error flake8 F401 path/to/files/ path/to/more/files/

To add noqa: F401 comments to ignore the F401 rule in ruff, run:

silence-lint-error ruff F401 path/to/files/ path/to/more/files/

fix silenced errors

If there is an auto-fix for a linting error, you can remove the ignore or fixme comments and apply the auto-fix.

For example, to remove all lint-fixme: CollapseIsinstanceChecks comments and apply the auto-fix for that rule, run:

fix-silenced-error fixit fixit.rules:CollapseIsinstanceChecks path/to/files/ path/to/more/files/

To remove noqa: F401 comments and apply the auto-fix for that rule, run:

fix-silenced-error ruff F401 path/to/files/ path/to/more/files/

Rationale

When adding a new rule (or enabling more rules) for a linter on a large code-base, fixing the existing violations can be too large a task to do quickly. However, starting to check the rule sooner will prevent new violations from being introduced.

Ignoring existing violations is a quick way to allow new rules to be enabled. You can then burn down those existing violations over time.

This tool makes it easy to find and ignore all current violations of a rule so that it can be enabled.

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

silence_lint_error-1.3.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

silence_lint_error-1.3.0-py2.py3-none-any.whl (14.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file silence_lint_error-1.3.0.tar.gz.

File metadata

  • Download URL: silence_lint_error-1.3.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for silence_lint_error-1.3.0.tar.gz
Algorithm Hash digest
SHA256 a7115b907fd685110eb7af15a26e4239abe5e386de6cfa3b774effb0e502bf67
MD5 e19e9d0db90194bb73797b860bf20870
BLAKE2b-256 964c8ceb2f8ed28c3913996520bdf1115c7088031ca088115a28104eb50979bb

See more details on using hashes here.

File details

Details for the file silence_lint_error-1.3.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for silence_lint_error-1.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 298b47d987e695749cae7c301ecdb0f5c48d048284f1e8d8b174cb6e0bfdb6ad
MD5 b5dfd0674d2c28ca3c5f908bf86137dc
BLAKE2b-256 666579d971a9828d4db54904b4da76a9d94ee07bb5475331a790095eb988eb24

See more details on using hashes here.

Supported by

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