Skip to main content

Linter that catches AI-generated code slop in Python — the ex_slop of the Python ecosystem.

Project description

py-slop

Linter that catches AI-generated code slop in Python.

Deep, single-ecosystem checks for patterns that LLMs produce but experienced Python developers don't — narrator comments, silent exception swallowing, docstrings that restate the signature, N+1 query loops, and more.

Modeled on ex_slop (40 Credo checks for Elixir). Where ex_slop integrates with Credo, py-slop ships as a standalone CLI and pre-commit hook. Ruff already covers the classics (E722, S110, B006, PGH003) — py-slop targets what ruff cannot express: checks that inspect comment/docstring content, cross-statement semantics, and framework-aware anti-patterns.

Status

v0.0.x — name-establishing release, API unstable. One working check ships today; a full audit against ruff's rule set will determine the v0.1.0 scope. See the roadmap below.

Installation

pip install py-slop

Usage

py-slop check path/to/file.py [more files...]

pre-commit (coming in v0.1.0)

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/augurcognito/py_slop
    rev: v0.1.0
    hooks:
      - id: py-slop

Checks

Check What it catches Why ruff can't
narrator-comment # First, we validate the input / # Here we fetch the user / # Step 1: Ruff never inspects comment content — only structure (ERA001 catches commented-out code, not narration)

Roadmap (v0.1.0, contingent on ruff coverage audit)

  • docstring-restates-signaturedef get_user(id): """Get the user by id."""
  • except-returns-silent-defaultexcept: return None beyond BLE001 scope
  • query-in-loop — N+1 queries in loops (Django/SQLAlchemy aware)
  • obvious-comment# Increment counter above counter += 1
  • step-comment# Step 1: ... / # Step 2: ...
  • boilerplate-docstring-paramsArgs: x: The x value

Each check will ship with an honest "ruff already covers X" overlap table.

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

py_slop-0.0.1.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

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

py_slop-0.0.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file py_slop-0.0.1.tar.gz.

File metadata

  • Download URL: py_slop-0.0.1.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for py_slop-0.0.1.tar.gz
Algorithm Hash digest
SHA256 aad84a46b2a77de8f66e1221fa62d6b4a1be496908f41b618a6745c2656af51f
MD5 bcb831a1eac1cc7b708f14a258bcadfe
BLAKE2b-256 82d97a14cb4076c16fdb151d7ed45ca4fbaf05c44acefa4380e61bb184350bca

See more details on using hashes here.

File details

Details for the file py_slop-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: py_slop-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for py_slop-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7e590a59874fb931007ef33121915b4665583208257c794c17c120be0bc19635
MD5 315d619477b77babe68a2fcf6225263f
BLAKE2b-256 f3fcf6c1af61af62ed1f53f6726008357131cbb3a60bfcb05dc0b8c5be25d07a

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