AI代码质量检测 是 AI Skill Hub 本期精选AI工具之一。综合评分 8.0 分,整体质量较高。我们强烈推荐将其纳入你的 AI 工具库,帮助提升工作效率。
AI代码质量检测 是一款基于 Python 开发的开源工具,专注于 ai-code-quality、ai-detection、code-analyzer 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
AI代码质量检测 是一款基于 Python 开发的开源工具,专注于 ai-code-quality、ai-detection、code-analyzer 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一:pip 安装(推荐)
pip install ai-slop-detector
# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install ai-slop-detector
# 方式三:从源码安装(获取最新功能)
git clone https://github.com/flamehaven01/AI-SLOP-Detector
cd AI-SLOP-Detector
pip install -e .
# 验证安装
python -c "import ai_slop_detector; print('安装成功')"
# 命令行使用
ai-slop-detector --help
# 基本用法
ai-slop-detector input_file -o output_file
# Python 代码中调用
import ai_slop_detector
# 示例
result = ai_slop_detector.process("input")
print(result)
# ai-slop-detector 配置文件示例(config.yml) app: name: "ai-slop-detector" debug: false log_level: "INFO" # 运行时指定配置文件 ai-slop-detector --config config.yml # 或通过环境变量配置 export AI_SLOP_DETECTOR_API_KEY="your-key" export AI_SLOP_DETECTOR_OUTPUT_DIR="./output"
<p align="center"> <img src="https://raw.githubusercontent.com/flamehaven01/AI-SLOP-Detector/main/docs/assets/AI%20SLop%20DETECTOR.png" alt="AI-SLOP Detector Logo" width="400"/> </p>
<p align="center"> <a href="https://pypi.org/project/ai-slop-detector/"><img src="https://img.shields.io/pypi/v/ai-slop-detector.svg" alt="PyPI version"/></a> <a href="https://pepy.tech/project/ai-slop-detector"><img src="https://static.pepy.tech/badge/ai-slop-detector/month" alt="Downloads/month"/></a> <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.8+-blue.svg" alt="Python 3.8+"/></a> <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="MIT License"/></a> <br/> <a href="https://github.com/flamehaven01/AI-SLOP-Detector/actions"><img src="https://github.com/flamehaven01/AI-SLOP-Detector/actions/workflows/ci.yml/badge.svg" alt="CI"/></a> <a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Black"/></a> <a href="https://github.com/flamehaven01/AI-SLOP-Detector/issues"><img src="https://img.shields.io/github/issues/flamehaven01/AI-SLOP-Detector.svg" alt="Issues"/></a> </p>
<p align="center"><b>Find AI-generated code that looks finished but isn't.</b></p>
<p align="center"> Catches what a normal linter passes over: empty functions with real-looking bodies, imports of things that don't exist, pipelines wired to nothing, copy-pasted logic, and docs that oversell what the code actually does.<br/> <b>Runs fully offline · deterministic core scoring · no API key, no model download, nothing leaves your machine.</b> </p>
Release track - Stable tag: v3.8.5 - Previous stable tag: v3.8.4 - v3.8.4 rewrites the documentation entry point in plain language (benefit-first README, "Why Not Just Use a Linter?" / "When NOT to Use This" sections, an acronym glossary in HOW_IT_WORKS, plain-meaning comments in CONFIGURATION) without changing any code or contracts. - v3.8.5 makes output dual-audience: the human summary hides internal algorithm names (no more vr_structural (exact MST)), while the JSON / agent / MCP output gains next_steps and metric_guide so AI agents receive the same actionable plan and metric semantics. JSON coherence_level is unchanged; new keys are additive.
---
Navigation: What Is It? • Why Not a Linter? • When Not to Use • Quick Start • Verification • Boundaries • How It Works • Document Map • What It Detects • Scoring • Key Features • Calibration • Security • CI/CD • Config • VS Code • Roadmap • Changelog • Release Notes • Schema Validation
---
Bootstrap — domain-aware, one command to start
slop-detector --init # auto-detect domain, generate .slopconfig.yaml
slop-detector --init --domain web/api # explicit domain override
slop-detector --init --adaptive-init --init-preview
slop-detector --init --adaptive-init --apply-init-suggestions --init detects your project domain from file patterns (8 built-in profiles: general, scientific/ml, scientific/numerical, web/api, library/sdk, cli/tool, bio, finance) and pre-seeds the weight profile accordingly. Also secures .slopconfig.yaml in .gitignore by default.
Adaptive init is now a separate safety layer:
--init --adaptive-init --init-preview--init --adaptive-init --apply-init-suggestions---
JS/TS Analysis — optional tree-sitter path
pip install "ai-slop-detector[js]"
slop-detector --project ./src # now includes .js/.jsx/.ts/.tsx files Activates JSAnalyzer v2.8.0 with tree-sitter AST (regex fallback when not installed). Results appear under js_file_results in ProjectAnalysis and JSON output.
---
Go Analysis — regex-based, optional tree-sitter-go path
pip install "ai-slop-detector[go]"
slop-detector --project ./src # now includes .go files Activates GoAnalyzer v1.0.0. Detects: empty function stubs, panic() as error handling, fmt.Println/Printf debug prints, _ = ignored errors, TODO/FIXME comments, god functions (> 60 lines). Results appear under go_file_results in JSON output.
---
Self-Calibration — the tool learns your codebase
slop-detector . --self-calibrate # see what your history recommends
slop-detector . --self-calibrate --apply-calibration # write to .slopconfig.yaml 4D grid-search (ldr / inflation / ddc / purity) over your run history. Optimizes all four weight dimensions simultaneously. - Project-scoped — history.db tags every record with a project_id (sha256 of cwd); calibration signal never mixes across different projects - Domain-anchored — grid search is constrained to ±0.15 around the current domain weights, preventing drift outside the domain's meaningful weight region - Drift warnings — CalibrationResult.warnings flags any dimension that shifted > 0.25 from the anchor - Only applies when confidence gap between top two candidates exceeds 0.10 - Milestone is triggered by files re-scanned (not raw record count), avoiding false triggers on first-time project scans
---
History Tracking — longitudinal quality analysis
slop-detector mycode.py --show-history # per-file trend
slop-detector --history-trends # 7-day project aggregate
slop-detector --export-history data.jsonl Every run auto-recorded to ~/.slop-detector/history.db. The history database is the training signal for ML self-calibration. docs/HISTORY_TRACKING.md →
---
| Version | Highlights |
|---|---|
| **v3.8.3** | human-friendly metric output (value / healthy direction / what it means + deficit bands) and deterministic Next Steps across rich/text/markdown; VS Code webview surfaces (4D breakdown, cleanup plan, pulse, diff-aware review); fixes for dead-code semantics, adaptive-init config preservation, and unused-deps stdlib / dev-tool false positives |
| **v3.8.2** | adaptive --init adds bounded repo-signal suggestions and preview/merge flows; npm wrapper adds typed contracts, Node API, and agent workflow docs; local impact tracking and opt-in telemetry become first-class observability surfaces |
| **v3.8.1** | cleanup-family outputs become confidence-ranked action plans; unused-deps grows manifest hygiene for pyproject.toml / package.json; boundary-violations gains opt-in layered architecture review with explicit rule evidence |
| **v3.7.9** | **Governance gate**: verify-governance fail-closed CLI, deterministic governance-record verification, and a formal split between scoring math and enforcement |
| **v3.7.3** | **Hotfix**: pydantic import wrapped in try/except ImportError — package imports cleanly in stripped environments; test_api_models.py guard corrected to fastapi; CI Docker login continue-on-error, quality gate pinned to >=3.7.3 |
| **v3.7.2** | **Core schema validation**: config.py Pydantic guards catch bad .slopconfig.yaml at load time (wrong weight types, domain_overrides non-int thresholds); LDRResult / DDCResult / InflationResult __post_init__ clamps protect GQG math.log(); HistoryEntry sanitises all LEDA calibration inputs + validates fired_rules JSON; **VS Code**: schema.ts ISlopReport interfaces + parseSlopReport() handwritten discriminated-union guard — schema mismatch surfaces exact field path before silent NaN |
| **v3.7.1** | LintEscapePattern docstring FP fix; self-scan avg_deficit 13.85 → 9.80; global_injector.py Patch 1 removed; .slopconfig.yaml domain_overrides expanded; **Skill**: 3-Phase Pipeline (Triage → Deep-Dive → Action Plan), /slop-delta before/after comparison, Confidence Routing by status band, → Next: guidance per command; **VS Code**: P1 monolith → 8 focused modules, P2 SlopCodeActionProvider (QuickFix for phantom_import/god_function/lint_escape), P3 TreeView sidebar (3-level hierarchy), P4 SlopCodeLensProvider (file summary + per-function hints) |
| **v3.7.0** | Dogfooding calibration + SKILL.md OSOT repair (10 violations); cli_renderer.py split (730 lines → 4 renderer modules); python_advanced.py split (1150 lines → 5 modules); BUG-1 ddc weight 0.30→0.20; BUG-2 findings filter threshold fix; BUG-3 AST-accurate test counts; BUG-5 block-scoped YAML rewrite in self_calibrator; 314 tests GREEN |
| **v3.6.0** | Claude Code Skill (/slop, /slop-file, /slop-gate, /slop-spar); CI gate bugfix (--ci-mode hard now exits non-zero without --ci-report); pre-commit hooks rewritten (python -m entry, 3 hook variants); VS Code Extension v3.6.0 VSIX; docs: Purity row, weight normalization note, [go] extra; 311 tests GREEN |
| **v3.5.0** | Domain-aware --init (8 profiles, --domain flag); JS/TS analysis via JSAnalyzer v2.8.0 + [js]; Go analysis via GoAnalyzer v1.0.0 + [go]; self-calibration patches: project-scoped history (project_id), re-scan milestone trigger, domain-anchored grid search (±0.15), CalibrationResult.warnings (drift > 0.25); 308 tests GREEN |
| **v3.4.1** | FileRole.STUB (Protocol/ABC stubs skip ldr+patterns); auto-discover .slopconfig.yaml; Python 3.8 CI compat; mypy attr-defined fix |
| **v3.4.0** | Per-rule FP rate tracking (LEDA Phase 2A); purity weight ceiling MAX_PURITY_WEIGHT=0.25 (Phase 2B) |
| **v3.3.0** | File role classifier (SOURCE/INIT/RE_EXPORT/TEST/MODEL/CORPUS); DDC annotation-only import fix; # noqa: F401 + __all__ re-export recognition |
| **v3.2.1** | Auto-calibration at every 10-scan milestone (no manual cmd); P2 git noise filter; P3 per-class thresholds (5+5); calibrate() min_events bugfix; 11/11 e2e GREEN |
| **v3.2.0** | 4D calibration (purity dimension); --init bootstrap; auto-calibration hints; 44/44 self-scan CLEAN |
| **v3.1.2** | data_collector refactor; slopconfig gap fill; 43/43 self-scan CLEAN |
| **v3.1.1** | Clone Detection in Core Metrics table; table style unification; VS Code UX |
| **v3.1.0** | 3 new adversarial patterns (function_clone_cluster, placeholder_variable_naming, return_constant_stub); GQG calibrator alignment; fhval SPAR-Code |
| **v3.0.2** | Phantom import 3-tier classification; __init__.py LDR fix; god_function LOW demotion |
| **v3.0.0** | Geometric mean scorer (GQG); purity dimension; DCF per-file; structural coherence |
| **v2.9.3** | Self-calibration engine; weight grid-search from usage history |
| **v2.9.0** | phantom_import CRITICAL detection; history auto-tracking |
Full Release Notes → · Changelog →
---
uvx ai-slop-detector mycode.py ```
The npm surface is intentionally thin:
- it does not reimplement analysis logic - it delegates into the Python CLI/runtime - it exists for Node-first teams that want npx-style entry without changing product semantics - it requires a Python backend and discovers it in this order: AI_SLOP_DETECTOR_EXECUTABLE -> active VIRTUAL_ENV -> PATH executables -> python -m slop_detector.cli - it ships version-pinned TypeScript interfaces at ai-slop-detector/types - it exports a small async Node API for scanProject, reviewChanges, computeHealth, and runCleanupFamily
Windows / PowerShell tip: PowerShell>redirection writes UTF-16 LE or UTF-8 with BOM by default, which breaksjson.load(..., encoding='utf-8'). Use--output <path>instead — it writes UTF-8 bytes (no BOM) directly, skipping the shell.
<p align="center"> <img src="docs/assets/cli-output.png" alt="CLI Output Example" width="800"/> </p>
---
```bash pip install "ai-slop-detector>=3.8.2"
slop-detector scan . # canonical analysis entry slop-detector review . --json # canonical changed-code review slop-detector pulse . --json # canonical repo health view slop-detector sweep dead-code . --json # canonical cleanup family
pip install "ai-slop-detector[js]" # JS/TS tree-sitter analysis pip install "ai-slop-detector[go]" # Go tree-sitter analysis
Your .slopconfig.yaml contains domain_overrides — a precise map of which functions are exempt from complexity rules. This is effectively a codebase weakness surface: it reveals which areas are too complex to refactor right now.
Best practice: - Run slop-detector --init to generate .slopconfig.yaml and auto-add it to .gitignore - To share governance config with your team, explicitly remove .slopconfig.yaml from .gitignore - Open-source repos committing it is fine (transparency over obscurity — see this project's own .slopconfig.yaml)
repos: - repo: https://github.com/flamehaven01/AI-SLOP-Detector rev: v3.7.3 hooks: - id: slop-detector # hard gate — fails on CRITICAL_DEFICIT >= 70 # - id: slop-detector-warn # soft mode — reports only, never blocks # - id: slop-detector-patterns # fast per-file pattern scan
**GitHub Actions** (runs on every PR):yaml
```yaml
weights: ldr: 0.40 inflation: 0.30 ddc: 0.20 purity: 0.10
patterns: god_function: domain_overrides: - function_pattern: "check_node" # AST walker — complex by design complexity_threshold: 30 lines_threshold: 200
ignore: - "tests/" - "/init.py"
advanced: exact_topology_ceiling: 300 topology_mode_above_ceiling: deterministic_approximate analysis_cache_enabled: true analysis_cache_db: "" churn_commit_window: 200 coverage_data_file: ".coverage" hotspot_limit: 10 hotspot_weights: deficit: 0.50 churn: 0.30 coverage_gap: 0.20
architecture: enabled: true preset: layered layers: [] ```
Full Configuration Guide → · Config Examples →
---
import { scanProject, reviewChanges, computeHealth, runCleanupFamily } from "ai-slop-detector"
```bash cp -r claude-skills/slop-detector ~/.claude/skills/
pre-commit (runs on every commit): ```yaml
- name: AI-SLOP Gate run: | pip install "ai-slop-detector>=3.7.3" slop-detector --project . --ci-mode hard --ci-report
**Enforcement modes:**bash --ci-mode soft # informational, never fails build --ci-mode hard # fails: deficit_score >= 70, critical_patterns >= 3, inflation >= 1.5, ddc < 0.5 --ci-mode quarantine # escalates repeat offenders after 3 violations ```
Full CI/CD Integration Guide →
---
Real-time inline diagnostics, debounced lint-on-type, ML score and purity signal in status bar. v3.7.1 rebuilt from a single 855-line monolith into eight focused modules.
What you see:
| Surface | Detail |
|---|---|
| Status bar | $(error) SLOP 45.2 — severity icon + deficit score, updates on save |
| Inline diagnostics | Pattern issues with line references — phantom imports, god functions, lint escapes |
| **TreeView sidebar** | Activity bar panel: files sorted by deficit score, metric rows (LDR/DDC/Purity/Inflation), issue list with click-to-navigate |
| **CodeLens** | Line 0: file summary (SLOP 45.2 — 3 CRITICAL); per-function: top severity icon + pattern IDs |
| **QuickFix (CodeAction)** | Lightbulb on phantom_import/god_function/lint_escape diagnostics — show output or add to .slopconfig.yaml ignore |
| ML signal | ML: 73% [slop] in summary diagnostic when [ml] extra is installed |
Commands (Ctrl+Shift+P > "SLOP"):
| Command | Description |
|---|---|
| Analyze Current File | On-demand single-file scan |
| Analyze Workspace | Project-wide scan, populates TreeView |
| Show 4D Breakdown | Webview: penalty attribution — why a file is not 0.0 |
| Show Cleanup Plan | Webview: confidence-ranked sweep family (safe/needs/unsafe) |
| Show Pulse Dashboard | Webview: project health + priority hotspots |
| Show Changed-Code Review | Webview: diff-aware review, new-vs-inherited slop |
| Auto-Fix Detected Issues | Apply (or dry-run preview) auto-fixable patterns |
| Show Gate Decision (SNP) | PASS/HALT with sr9/di2/jsd/ove metrics |
| Run Cross-File Analysis | Dependency + clone graph across project |
| Show File History | Per-file deficit score trend |
| Show History Trends | 7-day project-wide daily trend table |
| Export History to JSONL | Dump history.db records for external analysis |
| Bootstrap .slopconfig.yaml | Domain-aware config generation (--init) |
| Run Self-Calibration | LEDA 4D weight optimizer with one-click Apply |
Install from the VS Code Marketplace or build locally:
cd vscode-extension
npm install
npx vsce package # produces vscode-slop-detector-3.7.3.vsix
code --install-extension vscode-slop-detector-3.7.3.vsix
Settings (slopDetector.*): pythonPath, lintOnSave, lintOnType, failThreshold (default 50), warnThreshold (default 30), recordHistory, enableCodeLens (default true).
---
高质量的AI代码质量检测工具
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
经综合评估,AI代码质量检测 在AI工具赛道中表现稳健,质量优秀。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | AI-SLOP-Detector |
| Topics | ai-code-qualityai-detectioncode-analyzer |
| GitHub | https://github.com/flamehaven01/AI-SLOP-Detector |
| License | MIT |
| 语言 | Python |
收录时间:2026-06-07 · 更新时间:2026-06-07 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。