Skip to main content

Fast, deterministic linter for AI 'slop' in Python — runs right after Ruff.

Project description

sloplint

A fast, deterministic, no-LLM linter that counters AI slop in Python — a deliberately nitpicking, opinionated layer that runs right after Ruff in the same CI job. Ruff handles standard linting; sloplint adds the strict, slop-specific judgments Ruff intentionally won't ship, and never re-checks anything Ruff already covers.

Written in Rust, reusing Ruff's own parser crates for a full-fidelity AST + token stream.

What it targets

Patterns that no mainstream linter flags today:

  • Redundant "what" comments & docstrings that just restate the code (default: comments are banned, configurable per-path).
  • Cross-file duplicated / near-duplicate functions — copy-paste and "same logic, slightly different" (the flagship clone engine).
  • Redundant type hints, overly defensive try/except, verbose mechanical naming.
  • ASCII-only enforcement (no emoji), deep-nesting caps, oversized files, flat-directory fanout.
  • Deeply nested data-structure literals — a dict-of-lists-of-dicts inline blob past a configurable depth, distinct from control-flow nesting (model it with a named type).
  • Software-quality-metric badges + a per-PR summary, via a GitHub Action.

Installation

sloplint ships on PyPI as sloplintpy (the wheel bundles the native binary — no Rust toolchain needed). The installed command is sloplint.

Run it directly with uvx (the package and command differ, so use --from):

uvx --from sloplintpy sloplint check    # Lint all files in the current directory.
uvx --from sloplintpy sloplint metrics  # Report software-quality metrics.

Or install sloplintpy with uv (recommended), pip, or pipx — then run sloplint:

# With uv.
uv tool install sloplintpy@latest   # Install the `sloplint` command globally.
uv add --dev sloplintpy             # Or add it to your project.

# With pip.
pip install sloplintpy

# With pipx.
pipx install sloplintpy

Usage

Once installed, sloplint is a native binary on your PATH:

sloplint check path/to/code              # lint (exit 1 on findings)
sloplint check src --format sarif        # SARIF / json / github / text
sloplint metrics src                     # software-quality metrics table
sloplint metrics src --format github     # PR-summary markdown (CC risk tiers)
sloplint metrics src --max-cyclomatic 10 # CI gate: exit 1 over McCabe's ceiling
sloplint metrics src --badges badges/    # emit SVG + shields-endpoint badges
sloplint parse file.py                   # dump AST + tokens (debug aid)

From a clone, run it through cargo instead (cargo run -p sloplint -- check path/to/code), or build a wheel locally with maturin (maturin build --release).

Comments are banned by default; relax per-path in sloplint.toml. Heuristic rules (SLP001/002/040/060/084/120) are preview — enable with --preview. SLP120 flags low-cohesion "god classes" via LCOM4 (methods that split into unrelated groups; thresholds lcom4_max_components / lcom4_min_methods under [limits]).

GitHub Action

Run sloplint on every PR — it uploads SARIF (inline annotations), posts a findings summary comment, and can emit metric badges:

permissions:
  contents: read
  security-events: write
  pull-requests: write
jobs:
  sloplint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: galthran-wq/sloplint@main
        with:
          paths: src
          badges-dir: .sloplint-badges   # optional

Intended to run after Ruff in the same job. See action.yml for all inputs.

Required permissions: security-events: write (SARIF upload) and pull-requests: write (PR comment) — both shown above. Without them the action degrades gracefully (it warns rather than failing).

By default the action downloads a prebuilt binary for the runner (set version: to a release tag like v0.1.0, or latest); if none is available it builds from source. Cut a release to publish binaries:

git tag v0.1.0 && git push origin v0.1.0   # triggers .github/workflows/release.yml

Layout

Crate Role
sloplint CLI binary
sloplint_linter all rules + core run logic (cf. ruff_linter)
sloplint_python parser seam over the pinned ruff_* crates
sloplint_diagnostics rule-independent diagnostic model
sloplint_clone near-duplicate function detection
sloplint_metrics quality metrics + badges
sloplint_report output formatters (text/JSON/SARIF/markdown)
sloplint_dev development utilities (cf. ruff_dev)

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.

sloplintpy-0.2.0-py3-none-win_amd64.whl (2.1 MB view details)

Uploaded Python 3Windows x86-64

sloplintpy-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

sloplintpy-0.2.0-py3-none-macosx_11_0_arm64.whl (2.0 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

sloplintpy-0.2.0-py3-none-macosx_10_12_x86_64.whl (2.1 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: sloplintpy-0.2.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sloplintpy-0.2.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 d3fe4691d006958abc52579d0b07a6947dfcccdb5765d61ae3cd291e02ef5630
MD5 5ca8096d01a2847d7703d428ed6872cf
BLAKE2b-256 e1525eddc7723b7b6489bf9cb9292988b6970ff941297437f9328a6ff3b5a46d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sloplintpy-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4ee1b1c06cc17e91afad7d6e6873d302c733b42dfa398d3690dfae86ad957318
MD5 9b2a785cc84cf8b2f84e06fa91b427b2
BLAKE2b-256 69a40e3e6797b8e116b8aebfd5f33a56e7fbf00adf702e9784e2067acbc6de2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sloplintpy-0.2.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e15b1b198af4f9c1b4067f8113a8287489fd9b9aa5697c475ae6e32422073b8f
MD5 214898008c6df85481baf3271a1c2a2f
BLAKE2b-256 1f09f4ff3a4d50bcdf802e02a43b136ee816403905ff0d3ff28a7327bc1163de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sloplintpy-0.2.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 5ce672a7fed3d74418603cfc46f0352dfe7d2e93bbec21830362ec107d37c5fa
MD5 03ac553c36ec710a90ad48fc13c76e61
BLAKE2b-256 95e5a1ee5ebffeda75f009dcad1f7f3a0a6ee8b4ef9af515d161949592d7de01

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