Skip to main content

A framework for custom Python linters with auto-fixes and hierarchical configuration

Project description

Rattle

Tests PyPI version Supported versions Downloads license

Rattle is a Python linting framework built on LibCST with support for autofixes, custom in-repo lint rules, and hierarchical configuration.

Rattle is a fork of Fixit.

Features

  • Built-in lint rules for common Python issues
  • Autofix support when a rule can safely rewrite code
  • Local custom rules that can live inside your repository
  • Hierarchical pyproject.toml configuration
  • Pre-commit integration for CI and local workflows
  • LSP support

Install

Install the CLI from PyPI:

pip install rattle-lint

Install editor/LSP support too:

pip install "rattle-lint[lsp]"

Basic Usage

Rattle runs with no enabled rules until a project enables them in pyproject.toml:

[tool.rattle]
enable = ["fixit"]
rattle lint

Apply available autofixes:

rattle fix

Example Configuration

[tool.rattle]
root = true
enable = ["fixit"]
python-version = "3.10"
output-format = "rattle"
disable = [
    "NoStaticIfCondition",
    "UseLintFixmeComment",
]
per-file-disable = {"tests/generated.py" = ["NoNamedTuple"]}

[[tool.rattle.overrides]]
path = "legacy"
enable = ["fixit_extra"]

[[tool.rattle.overrides]]
path = "tests"
enable = ["NoNamedTuple"]

License

MIT

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

rattle_lint-1.1.0.tar.gz (202.7 kB view details)

Uploaded Source

Built Distribution

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

rattle_lint-1.1.0-py3-none-any.whl (129.7 kB view details)

Uploaded Python 3

File details

Details for the file rattle_lint-1.1.0.tar.gz.

File metadata

  • Download URL: rattle_lint-1.1.0.tar.gz
  • Upload date:
  • Size: 202.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for rattle_lint-1.1.0.tar.gz
Algorithm Hash digest
SHA256 5495bbfa7e325dc7875cd1be2a32d69134c50490b0d701777103d7e2b19348f0
MD5 9b23e95cda34b9fb42819a77ecb150b7
BLAKE2b-256 84a39e4a4197a13308aead57604ea641ed2d59ed5d61958344bdfbee9355cee4

See more details on using hashes here.

File details

Details for the file rattle_lint-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: rattle_lint-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 129.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for rattle_lint-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f62e5c6b6fa7b0d9d31f8f1c1d9c18319ddba56906c7f6a557ea6ef68495a0b6
MD5 4c0ea8acdb3d31701d4d573b18466b8c
BLAKE2b-256 0aac1980a6156d21cc0667afc6eac4a06f05116ee3baa098969da7cfcdf9f888

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