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/
structloglint --path . --select SL001,SL002 --ignore SL007 --output-format concise
structloglint --path . --max-event-length 40 --event-case-style camelCase

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"
select = ["SL001", "SL002", "SL003", "SL004", "SL005", "SL006", "SL007", "SL008", "SL009"]

[tool.structloglint.rules]
SL007 = "off"       # disable loop check
SL009 = "error"     # promote to error

Alternatively, create a standalone structloglint.toml in your project root (takes precedence over pyproject.toml). In standalone format, omit the [tool.structloglint] table wrapper:

# structloglint.toml (standalone)
event-case-style = "camelCase"
max-event-length = 50

[rules]
SL007 = "off"

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
CLI config overrides --event-case-style, --max-event-length, --loop-log-level flags
Rule selection --select / --ignore CLI flags + select / ignore config keys
Per-rule severity [tool.structloglint.rules] for off / warning / error overrides
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 18 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

Must Have

Area Detail Status
--fix flag Apply auto-fixes in-place (SL008 fix model already exists) 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.3.0-py3-none-win_amd64.whl (1.8 MB view details)

Uploaded Python 3Windows x86-64

structloglint-0.3.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.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

structloglint-0.3.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.3.0-py3-none-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

structloglint-0.3.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.3.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for structloglint-0.3.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 999994eb223bbcbd10baad4524c28075623c0d3dc6ed169f4ff7d13bae77faf5
MD5 b3edb920427a2683392822b9c0bb1d90
BLAKE2b-256 30a11e0417504fd7c446226a66eb99425d49f7b1919bdc37441f57e12167a5c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for structloglint-0.3.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.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for structloglint-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8d6c5dab6c0ed46b89695834ae004a2315c2411275b5926aca8a0afb8820f43d
MD5 2446e983854c3a61b1116680823b6f2e
BLAKE2b-256 e3d2bb909cd0a13d8ec50df1ccc916aa28fd05329595f725f4bbd0f58452e972

See more details on using hashes here.

Provenance

The following attestation bundles were made for structloglint-0.3.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.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for structloglint-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3d1c79ae63f3a37d9513dcf376775b2061b5f239adcf28789d3da4dc09dd39ba
MD5 9c4418377007c3cfd363a7767d908132
BLAKE2b-256 e34d4f592890e696f1a5a57d891ae617dc0d912adefbb757e792541ca2cd78cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for structloglint-0.3.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.3.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for structloglint-0.3.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 169cb2ebaedf2616eb0d24fba63999f0e7ffaf9798e3993fa645507e6e04deb9
MD5 9dcbfa93826bc2f8d4fbbde10037a2bd
BLAKE2b-256 a620134e751a3856696e9119acf1cad08767d2e8e9a31398337574776caacfad

See more details on using hashes here.

Provenance

The following attestation bundles were made for structloglint-0.3.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.3.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for structloglint-0.3.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6ef71a67df4f388b4c986497c2a40b1f65b1da245107d63c5a99cb3ce654ef96
MD5 9fb38eceb32a8ccae23dc47f9d2072a1
BLAKE2b-256 e006355dfc8193d406d7150051f23f589104eace9fc3ebdad377fd9632bbf5ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for structloglint-0.3.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.3.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for structloglint-0.3.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1b53d191e508889aa92e1049ecd86a77e756fdf083d2c6c09db39609a587eece
MD5 65e6e005e0d66a01acb462ffe82b587f
BLAKE2b-256 f2b6430de47535bf82bf869c7017a45557e1dc81f0c5839fe0615c09e873e5a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for structloglint-0.3.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