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.6.tar.gz (173.1 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.6-py3-none-any.whl (106.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rattle_lint-1.0.6.tar.gz
  • Upload date:
  • Size: 173.1 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.6.tar.gz
Algorithm Hash digest
SHA256 3b9e86d079bbc2aff581b5b6e470d141db40af74ed7e3e0f0624ef612024e0d5
MD5 16a175e09ce068a0ac7a9c787fbc366b
BLAKE2b-256 309ec353cfc51dc7d20839a952f19425e33eec0a200d1241aa693e5654c87acd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rattle_lint-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 106.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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5de39bc2f324e9693f17e66ce8351ceed0dc31f1a35e1945e4501c7c5938256b
MD5 21a02425b91d6180b9da2cf9b00738d5
BLAKE2b-256 7f13a30875ec76b26b81f459017beca82e5472ec3100ed4b8199d20846b4579b

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