Skip to main content

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

Project description

py-slop

PyPI

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, boilerplate docstrings, 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.

Installation

pip install py-slop

Usage

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

Checks

Comment / docstring content (ruff can't — it never inspects content)

Check What it catches Nearest ruff rule
narrator-comment # First, we validate the input / # Here we fetch None — ERA001 catches commented-out code, not narration
obvious-comment # Fetch the user above user = get_user(id) None
step-comment # Step 1: validate / # Step 2: process None
boilerplate-docstring def get_user(id): """Get the user.""" D-series checks formatting, not semantic redundancy

Error handling (beyond ruff's scope)

Check What it catches Nearest ruff rule
except-returns-default except: return None / "" / 0 / False / [] / {} BLE001 flags blanket except:, not what it returns
except-log-continue except Exception as e: logger.error(e) — logs but swallows None — behavioral analysis of except bodies
useless-try-except try: f() except e: raise e — redundant wrapper TRY302 is similar but not identical

Patterns

Check What it catches Nearest ruff rule
query-in-loop N+1 queries in loops (Django objects.*, SQLAlchemy session.*) None — no framework-aware detection
redundant-boolean-return if x: return True; else: return False SIM103 covers the no-else form; this catches explicit else

Ruff overlap honesty

Run ruff for these — py-slop deliberately does not duplicate them:

Pattern Ruff rule
Blanket except: BLE001
Bare except Exception: + pass S110
print() left behind T201
Commented-out code ERA001
Blanket type: ignore PGH003
Mutable default arguments B006

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.1.1.tar.gz (30.9 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.1.1-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_slop-0.1.1.tar.gz
  • Upload date:
  • Size: 30.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for py_slop-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c43c5f61963360622db25c73d77d5619f86b4f52823cf3f85af667e43531dd8f
MD5 14275c0744e6765ba6005bf533bbd4de
BLAKE2b-256 4e87591619e00c16f23d702e1fe0e09385befc7a40cc70d317d71929a597a281

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_slop-0.1.1.tar.gz:

Publisher: publish.yml on AugurCognito/py_slop

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

File details

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

File metadata

  • Download URL: py_slop-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for py_slop-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9d23a924c21d27dd7f216f8a10219a606380522652e36e5ad10b70a63909f6b1
MD5 10142e6944e61cc7f7bb83bc5af8d781
BLAKE2b-256 de1324710f203cbac48d7d671e9f422985239ea3d4936fb0b4235e46e528e0af

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_slop-0.1.1-py3-none-any.whl:

Publisher: publish.yml on AugurCognito/py_slop

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