Slop Lens
AI tarafından üretilmiş kodun "slop" izlerini bulan ücretsiz analiz aracı. Paste code → 0–100 arası Slop Skoru + 12 pattern kırılımı + opsiyonel LLM yargısı.
Live: https://holyai.me/slop-lens/
Stack: Node.js · Express · better-sqlite3 (WAL) · node-cron · helmet · compression
Port: 4770 · BASE_PATH: /slop-lens · AUTH: yok (tüm endpoint'ler public)
Niye?
Datadog State of AI Engineering 2026 raporuna göre developer'ların %95'i AI coding tool kullanıyor, %56'sı işinin %70+'ını AI ile yapıyor. Sonuç: Addy Osmani'nin ifadesiyle "inconsistency, duplicate logic, mismatched method names" — yani slop.
Slop Lens bu izleri tespit eder:
- Yorum balonu (>%30 yorum yoğunluğu)
- "// increment i" tarzı bariz yorum
x === null || x === undefinedzincirleri- Helper patlaması (5+ tek-kullanımlık fonksiyon)
- 28+ karakter şişkin identifier
- TODO/FIXME/
Not implementedplaceholder - Magic string kümeleri (3+ tekrar)
as any/@ts-ignorekaçışları- Try-swallow (
catch(e){console.log}) `ya da "Here is the code" markdown kalıntılarıawaitsizasync- 5+ satır JSDoc abartısı
Endpoint'ler (auth-free, hepsi)
| Method | Path | İşlev |
|--------|------|-------|
| GET | /slop-lens/ | SPA |
| GET | /slop-lens/health | 200 OK |
| POST | /slop-lens/api/analyze | {code, language?, public?, llm_judge?} → analiz |
| GET | /slop-lens/api/snippet/:pid| Public snippet detay |
| GET | /slop-lens/api/recent | Son 50 public analiz |
| GET | /slop-lens/api/leaderboard | En sloppy 25 snippet (son 30 gün) |
| GET | /slop-lens/api/patterns | Pattern kataloğu |
| GET | /slop-lens/api/stats | Genel istatistikler + trend |
| POST | /slop-lens/api/feedback | Topluluk oyu (ai/human) |
| GET | /slop-lens/api/feedback/:pid | Oy aggregate |
| POST | /slop-lens/api/stats/run | Manuel cron tetikle (ops) |
Score formülü
raw = Σ min(hit_count × severity_weight, 30) # her pattern
score = clamp(raw / 1.5, 0, 100)
loc < 20 ise score *= 0.7
Bin'ler: 0–33 İnsan Eli · 34–66 Karışık · 67–100 Saf Slop.
Hızlı başlangıç
npm install
cp .env.example .env
# .env içinde DB_PATH ve isteğe bağlı OPENROUTER_API_KEY ayarla
npm start
# → http://localhost:4770/slop-lens/
Kullanım örnekleri
### CLI
``bash``
curl -s -X POST http://localhost:4770/slop-lens/api/analyze \
-H 'Content-Type: application/json' \
-d "$(jq -n --rawfile c sample.js '{code:$c, language:"javascript", public:false}')" \
| jq '.slop_score, .bin_label'
### CI integration (örnek)
``yaml``
- name: Slop check
run: |
SCORE=$(curl -s -X POST $SLOP_API/api/analyze \
-H 'Content-Type: application/json' \
-d "{\"code\": \"$(cat src/new.ts | jq -Rs .)\"}" | jq '.slop_score')
[ "$(echo $SCORE | cut -d. -f1)" -lt 50 ]
Veritabanı
better-sqlite3 WAL modunda. 4 tablo: analyses, pattern_hits, feedback, daily_stats.
Public olmayan analizler 30 günde otomatik silinir (cron 04:00).
LLM Judge
llm_judge: true body parametresi ile OpenRouter (anthropic/claude-haiku-4.5 default) çağrılır.
Key yoksa endpoint hata vermez, llm.verdict: null döner.
Privacy
- IP adresleri SHA-256 hash'lenip 16 karaktere truncate edilir (rate-limit / abuse audit için).
- Snippet'ler default private — public yapılmadıkça leaderboard / recent'e düşmez.
- Public olmayan snippet'ler 30 gün sonra silinir.
License
MIT.