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]"

Agent Skill

The official AI agent skill can be installed from this repo.

npx skills add https://github.com/zigai/rattle/tree/main/src/rattle/.agents/skills/create-rattle-lint-rules

or

uvx library-skills

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

Explain rule metadata, examples, and settings:

rattle explain use-f-string
rattle explain --json use-f-string

Example Configuration

[tool.rattle]
root = true
enable = ["fixit"]
python-version = "3.10"
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.2.1.tar.gz (256.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.2.1-py3-none-any.whl (173.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rattle_lint-2.2.1.tar.gz
  • Upload date:
  • Size: 256.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.2.1.tar.gz
Algorithm Hash digest
SHA256 d6182a09624378806bc0ae24914a52ca14a7d8d0091d4a6e7892f245a88e522e
MD5 2761f2285d91b5f01ba8ba77aebeb0eb
BLAKE2b-256 ef1372c7b18dead47c4bdd7b498bb2add880fff3ab91c24cc3875f67ad6a14b0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rattle_lint-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 173.2 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.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2510eb275443d1e21019f927378283335d659917a27bcc526d42bd7898d43beb
MD5 c77b1f27a9431faeeacab7fd32a709b9
BLAKE2b-256 1c3e47e79e7cef0190aacdc18553b0573a51763447dae61fb3cd4f08775a879d

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