Skip to content

zigai/rattle

Repository files navigation

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

About

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

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors