Skip to main content

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

Project description

Rattle

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; see LICENSE and NOTICE.

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.2.tar.gz (170.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-1.0.2-py3-none-any.whl (103.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rattle_lint-1.0.2.tar.gz
  • Upload date:
  • Size: 170.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-1.0.2.tar.gz
Algorithm Hash digest
SHA256 9814239e730e2a710d421085e90f14c4814c3a5e94fa173ee679be5e9c9315e3
MD5 6cf15c1c3767ee2a4ef8c8b416501e9f
BLAKE2b-256 a4e6df4ba0a914256f745fce578e0acadbfea1df0ce452d9a4141de3cc1c30dc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rattle_lint-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 103.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7a3d47690d0d017932fe7b774267667c6eff4ccc0333031e91d8b201689fe8d7
MD5 418b98239986dc20fb77510fe48d16e5
BLAKE2b-256 154abaf9f3c57db60535687d3e8c860a6ee7a827c1fb3fbd6b49c1bc8fa0ef2d

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