Skip to content

zigai/rattle

Repository files navigation

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

  • 48 built-in lint rules
  • 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

About

Framework for custom Python linters with auto-fixes

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors