Skip to main content

A fast, opinionated linter for structlog log calls in Python. Written in Rust.

Project description

structloglint

A fast, opinionated linter for structlog log calls in Python. Written in Rust.

Status: Early development (v0.1.1)

Installation

uv pip install structloglint

From source

uv venv
source .venv/bin/activate
uv pip install maturin
maturin develop --release

Usage

structloglint --path src/ --verbose

See RULES.md for the full list of rules (SL001--SL009) and configuration options.

Configuration

Add a [tool.structloglint] section to your pyproject.toml:

[tool.structloglint]
event-case-style = "snake_case"
max-event-length = 30
loop-log-level = "info"

Alternatively, create a standalone structloglint.toml in your project root (takes precedence over pyproject.toml).

See RULES.md for all configuration options.

Roadmap (MoSCoW)

Done

Area Detail
Linting rules SL001--SL009 fully implemented with unit tests
AST walker Recursive Python AST traversal via rustpython-parser with parent context tracking (19 block types)
Logger detection Naming-convention heuristic (matches log, logger, LOG, *_logger, etc.)
CLI --path, --verbose, --output-format full|concise via clap
Output Colored diagnostics with source context, gutter markers, and underline spans
Fix data model Fix struct exists, SL008 generates fix suggestions
Configuration pyproject.toml ([tool.structloglint]) and standalone structloglint.toml with directory-tree discovery
Integration tests 14 integration tests using fixture Python packages with config variations
Python packaging maturin build so uv pip install structloglint works
Pre-commit hook .pre-commit-hooks.yaml for use in .pre-commit-config.yaml
CI/CD GitHub Actions: fmt, clippy, test on push/PR
Release management release-please for automated changelogs, version bumps, and GitHub releases
Cross-platform builds CI matrix for Linux (x86_64, musl, aarch64), macOS (x86_64, aarch64), Windows (x86_64)
Binary distribution Publish wheels per platform to PyPI via maturin
Exit codes Non-zero exit on findings for CI gating
Rule selection --select / --ignore CLI flags + select / ignore config keys

Must Have

Area Detail Status
--fix flag Apply auto-fixes in-place (SL008 fix model already exists) not started
CLI config overrides --event-case-style, --max-event-length, --loop-log-level flags not started
Inline suppression # noqa: SL001 style comments to suppress per-line not started

Should Have

Area Detail Status
JSON / SARIF output Machine-readable output for CI integrations (GitHub code scanning, etc.) not started
GitHub Actions output --output-format github for inline PR annotations not started
--diff mode Show fixes as unified diffs without applying not started
SL010 rule Event string should use past tense not started
Benchmarks Performance regression tracking in CI not started

Could Have

Area Detail
GitHub Action Marketplace action for direct use in workflows
Editor integration VSCode extension / LSP server
Custom rule plugins User-defined rules via config or scripting
Watch mode Re-lint on file change

Won't Have (for now)

Area Reason
Full type inference Would require a Python type checker; naming heuristic is sufficient
Auto-fix for all rules Some rules (SL005, SL007) require structural refactoring that can't be automated safely
flake8 plugin mode Targeting standalone tool distribution like ruff instead

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

structloglint-0.2.0-py3-none-win_amd64.whl (1.7 MB view details)

Uploaded Python 3Windows x86-64

structloglint-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

structloglint-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

structloglint-0.2.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.8 MB view details)

Uploaded Python 3manylinux: glibc 2.5+ x86-64

structloglint-0.2.0-py3-none-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

structloglint-0.2.0-py3-none-macosx_10_12_x86_64.whl (1.7 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file structloglint-0.2.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for structloglint-0.2.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 6f61f90a14e7602e3abe3d923ff9f777336ee5736c50a8e59133afe349cf2dd4
MD5 a1d3b0fabbdf0e8421fcc9e35c740d88
BLAKE2b-256 4eb93fcae59bd732fc2d203cdcc2bbefe890d5fa25ffd012ae210581603eb171

See more details on using hashes here.

Provenance

The following attestation bundles were made for structloglint-0.2.0-py3-none-win_amd64.whl:

Publisher: release.yml on maxilar20/structloglint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file structloglint-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for structloglint-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 102cffd2df729a4595f0db4179f9c3a142984e744ecb40aa6d7f09287dfbd5d5
MD5 010fdd5765b440d9d331ce552d912b28
BLAKE2b-256 583472c69f7e55d8b68ca3dd3275f072f8f2823b80222bd27188a7f316015707

See more details on using hashes here.

Provenance

The following attestation bundles were made for structloglint-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on maxilar20/structloglint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file structloglint-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for structloglint-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 122422b608767778ea8ea3698b08fa247c71a6aa604b11a126894e726a91da3d
MD5 481f2ad65b8bb57d02996d8caab53b08
BLAKE2b-256 f514facf3a7c4443b730fa1fff4e4108baeda97b4593313165c43b9a7f15d460

See more details on using hashes here.

Provenance

The following attestation bundles were made for structloglint-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on maxilar20/structloglint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file structloglint-0.2.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for structloglint-0.2.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 86c7d3e5d1c6026d3964ef9c4b0d1714b58f4f487de0b228a4d63690d181f7ab
MD5 321c157ab9b5b23b173c9251fbf8fa2d
BLAKE2b-256 9179b3463e89dfd5aede85e5e6aa6e776517efd91d374d36746363eba6661f81

See more details on using hashes here.

Provenance

The following attestation bundles were made for structloglint-0.2.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl:

Publisher: release.yml on maxilar20/structloglint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file structloglint-0.2.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for structloglint-0.2.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2a2d3336d8c0fc3b6a94be7cc40e454793df0c23ffa453a8bcdd25476661849b
MD5 545649fe20bdd6c07947d8c85acd665d
BLAKE2b-256 fb5f79f46b309b93ac4ace5f902e83a162365a3b9b172e9372dca0d417228a66

See more details on using hashes here.

Provenance

The following attestation bundles were made for structloglint-0.2.0-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on maxilar20/structloglint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file structloglint-0.2.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for structloglint-0.2.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 aba0212671da4d005b4f2fb6de2f3abc8b78b453f15e2b064295cbbcd04f2c3f
MD5 a24898902cead5622c1535fb6b69af3b
BLAKE2b-256 e1a486ad6d6b93c49a8fd6054e9bb3506dbbacef49161f68aec07f1d1ccdb2ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for structloglint-0.2.0-py3-none-macosx_10_12_x86_64.whl:

Publisher: release.yml on maxilar20/structloglint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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