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 lint

Apply available autofixes:

rattle fix

Example Configuration

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

[tool.rattle.options.UseFstring]
simple_expression_max_length = 40

[[tool.rattle.overrides]]
path = "tests"
enable = ["UseAssertIn"]
options = { UseFstring = { simple_expression_max_length = 60 } }

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.0.3.tar.gz (171.5 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.0.3-py3-none-any.whl (104.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rattle_lint-1.0.3.tar.gz
  • Upload date:
  • Size: 171.5 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.0.3.tar.gz
Algorithm Hash digest
SHA256 406ad8c3c3c0bc78bdac23e5bfaf5cf92d0ec1433a59047a55da458436ad7ae2
MD5 e35e98fd3e60c45bce4fa50563dfab51
BLAKE2b-256 61cf7e8fbea7ce6c93b7ab735d69132a93322eab1e46307c44595283532c21c4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rattle_lint-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 104.5 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.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 163d4fe116f38a671bc9d711a123ba26830e67da144d23268b62af399f940ea9
MD5 ea06a5dbf7170115aeb2e87d1552eeec
BLAKE2b-256 8b0b4a77b4bfe671529244ba3ddbb9b75536eecaf2369e60dce171059ea943a1

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