code-smell-detection v1.0 — 103 hand-authored examples, 20 smell types, 6 languages

#1
by SalutefaceAAC - opened

code-smell-detection v1.0 — now live!

Excited to share Code Smell Detection, a curated synthetic dataset of 103 hand-authored code snippets labelled with 20 classic software engineering code smells across 6 languages.

What's inside

  • 20 smell types from Fowler's Refactoring taxonomy: Long Method, God Object, Feature Envy, Data Clumps, Message Chains, Refused Bequest, Parallel Inheritance, and 13 more
  • 6 languages: Python, JavaScript, TypeScript, Go, Java, Rust
  • 3 severity levels (low / medium / high) + a clean negative class (~6%) to prevent trivial "always-smelly" classifiers
  • 3 difficulty levels (beginner / intermediate / advanced)
  • Each example includes the raw code snippet, a plain-English explanation of why it's a smell, and a concrete refactoring suggestion
  • Splits: train (72) / val (15) / test (16) in both JSONL and Parquet

Design principles

  • Authenticity: snippets look like real production code, not toy examples
  • Language-idiomatic: Go interfaces, Rust newtypes, Java Spring patterns, TypeScript generics are all respected
  • Negative class included: 6 clean examples prevent models from learning trivial shortcuts
  • Severity calibrated: high = structural problem affecting testability; medium = noticeable but contained; low = minor maintenance debt

Use cases

  • Fine-tuning or evaluating LLM code-review capability
  • Training lightweight classifiers (smell type or severity)
  • Few-shot prompting for automated PR review
  • Teaching material for software engineering courses

Quick start

from datasets import load_dataset
ds = load_dataset("SalutefaceAAC/code-smell-detection")
print(ds["train"][0])

Related datasets in this series

Feedback, issues, and PRs very welcome — especially suggestions for smell types or language coverage to prioritize in v1.5!

Sign up or log in to comment