Skip to main content

A PR quality and production-slop detector to stop bad patches before merge.

Project description

SlopGuard

SlopGuard is a fully open-source, zero-backend, zero-hosting-cost tool designed to analyze pull requests and local git diffs to detect low-value, production-risky, overengineered, inefficient, or unnecessary code changes.

This is NOT an “AI detector.” Instead, it is a “PR quality and production-slop detector.” Its goal is to stop bad patches before they merge by identifying architectural and logical smells natively associated with rushed or auto-generated "slop", regardless of who wrote it.

What SlopGuard Catches

  • Unnecessary abstractions and wrapper layers
  • Useless helper functions that add zero value
  • Dead code, unused imports, empty branches
  • Broad exception swallowing inside core logic
  • Over-split logic
  • Fake edge-case handling
  • Style drift from the repository baseline
  • Repeated expensive calls/computations in loops

What SlopGuard is NOT

  • It does not ping expensive cloud LLM APIs.
  • It does not attempt to probabilistically classify code as "AI" or "Human".
  • It does not run a server or webhook backend.

Installation

You can install it directly from the repo (or PyPI once published):

pip install -e .

CLI Usage

Run SlopGuard inside any repository to analyze current changes:

Local Diff:

slopguard analyze --repo . --base main --head HEAD

Staged Changes:

slopguard analyze --staged

Patch File:

slopguard analyze --patch diff.patch

Direct File:

slopguard analyze file path/to/file.py

Other Commands

  • slopguard explain - Explain why a file or finding was marked.
  • slopguard rules list - See available rules.
  • slopguard config init - Generate a baseline .slopguard.yml config file.
  • slopguard autofix --safe - Apply explicit, 100% safe automatic fixes for unambiguous dead code.

GitHub Action

Run SlopGuard on PRs utilizing native inline GitHub review comments using reviewdog. Create .github/workflows/slopguard.yml:

name: SlopGuard
on: [pull_request]

jobs:
  analyze:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - uses: ./ # Or your organization/slopguard
        with:
          reporter: "github-pr-review"
          level: "warning"

Performance Rules

In addition to architecture and dead code, SlopGuard specifically flags performance bottlenecks such as:

  1. repeated_expensive_call_in_loop: Networking or DB operations firing implicitly in loops creating N+1 issues.
  2. unnecessary_data_copy: Useless RAM allocation natively via redundant list() casting.
  3. sync_blocking_in_async_context: Accidentally destroying concurrency by invoking blocking requests in event loops.

Configuration

Configure using .slopguard.yml in your repository root. Setup thresholds, toggle baseline checks, and customize rule severity.

slopguard config init

Contributing

See CONTRIBUTING.md.

License

MIT License.

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

slopguard_core-0.1.0.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

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

slopguard_core-0.1.0-py3-none-any.whl (36.4 kB view details)

Uploaded Python 3

File details

Details for the file slopguard_core-0.1.0.tar.gz.

File metadata

  • Download URL: slopguard_core-0.1.0.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for slopguard_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 749571487e84ddc5dfea25872e816a9ed90bc5e0a1c9f942b1fc4b15ae4bce03
MD5 93b776c513ea3c0610eb3e1d64f168d2
BLAKE2b-256 5dfa7e9cb81e027a268dbbb2740457a18b092aef836658d3c38a9432e91935ea

See more details on using hashes here.

File details

Details for the file slopguard_core-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: slopguard_core-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 36.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for slopguard_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4fa618689a8c1e4bfe24a3ef6aa5dafbec1bcc97be1e6980e7425ee869f1aa43
MD5 e80dadb5fe436b7f851bf11f1c154764
BLAKE2b-256 78537fa9a180f3167a4955f0e9074d85f875f4cd23c76ac12a289cc8fc9eaedd

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