Skip to main content

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

Project description

Rattle

Tests Documentation Status 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 = [
    "no-static-if-condition",
    "use-rattle-ignore-comment",
]
per-file-disable = {"tests/generated.py" = ["no-named-tuple"]}

[[tool.rattle.overrides]]
path = "legacy"
enable = ["fixit-extra"]

[[tool.rattle.overrides]]
path = "tests"
enable = ["no-named-tuple"]

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-2.0.1.tar.gz (249.6 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-2.0.1-py3-none-any.whl (161.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for rattle_lint-2.0.1.tar.gz
Algorithm Hash digest
SHA256 cc9d54c565d154d1e01e33e3a578bfcc0b6c9e6cd6d184acdfd046a1747e918a
MD5 434591f30d1a82f9e54aaef2b4747aa7
BLAKE2b-256 ff4ee62a231ad9362fd55292d017183da12c311683c8441e9de2436abb9cd076

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rattle_lint-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 161.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-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7a1e775ba18fa110bc22b99738671c15c3c0843aa04fe65cd9e6f7c9f332d9b1
MD5 85caa4edf68a4a7b1b70cb7ce1f0b901
BLAKE2b-256 7d559c190e453e0898ab2316cacbb9fce63b0717f36f4854202808d3779e1de1

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