← Latest papers
💻 computer science

SACS: A Code Smell Dataset using Semi-automatic Generation Approach

This paper introduces SACS, a large-scale, open-source code smell dataset covering Long Method, Large Class, and Feature Envy, which was created using a semi-automatic generation approach that combines automated rule-based sampling with targeted manual review to overcome the trade-off between data scalability and label reliability.

Original authors: Hanyu Zhang, Tomoji Kishi

Published 2026-04-21
📖 5 min read🧠 Deep dive

Original authors: Hanyu Zhang, Tomoji Kishi

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are a master chef trying to teach a robot how to cook perfect meals. To do this, you need a massive library of recipe cards: some showing perfect dishes and others showing disastrous kitchen mistakes (like burning the toast or forgetting the salt).

In the world of software, these "mistakes" are called Code Smells. They aren't bugs that crash the program, but they are messy, confusing, or inefficient ways of writing code that make it hard to fix or update later. Examples include a function that is too long (a "Long Method"), a class that tries to do too many things (a "Large Class"), or a piece of code that is constantly borrowing tools from a neighbor instead of using its own (a "Feature Envy").

The problem? Teaching a robot (or an AI) to spot these smells requires thousands of examples. But finding these examples is a nightmare.

The Problem: The "Human vs. Robot" Dilemma

The paper describes a struggle between two ways to build this library of examples:

  1. The "Human Chef" Approach (Manual): You hire expert chefs (senior developers) to read every single recipe card and label the mistakes.
    • Pros: The labels are super accurate.
    • Cons: It takes forever and costs a fortune. You can't make a library big enough for a smart AI to learn from.
  2. The "Robot Chef" Approach (Automatic): You use a script to randomly mess up good recipes to create mistakes.
    • Pros: You can make millions of examples in seconds.
    • Cons: The robot is clumsy. It might create "fake" mistakes that don't look like real human errors, or it might miss real ones. The quality is low.

The Solution: The "Semi-Automatic" Kitchen

The authors of this paper, Hanyu Zhang and Kishi Tomoji, decided to combine the best of both worlds. They created a Semi-Automatic approach, which they call SACS.

Think of it like a high-tech assembly line with a quality control inspector:

Step 1: The Robot Makes the Mess (Automatic Generation)

First, they use a computer program to intentionally "break" good code.

  • Long Method: The robot takes two small, neat functions and glues them together into one giant, confusing block.
  • Large Class: It takes a small, focused class and dumps a bunch of unrelated features into it, making it bloated.
  • Feature Envy: It moves a function that belongs in one room into a different room where it has to constantly ask for tools it doesn't own.

Step 2: The Smart Filter (Grouping)

Now, the robot has a pile of "messy" code. But it doesn't know which ones are obviously messy and which ones are maybe messy.

  • The system uses a traffic light system based on simple math (metrics like lines of code).
    • Green Light (A_Group): The code is so messy (e.g., 100+ lines) that even a novice knows it's a smell. The robot labels this as "Definitely a Mistake" and puts it in the library. No human needed!
    • Red Light (M_Group): The code is so clean that it's definitely not a mistake. The robot labels this as "Definitely Clean."
    • Yellow Light (M_Group): The code is in the "gray area." It's not clearly messy, but it's not clearly clean either. This is where the robot gets confused.

Step 3: The Human Inspector (Manual Review)

Here is the magic trick: The humans only look at the "Yellow Light" (ambiguous) cases.

  • Because the robot handled the obvious "Green" and "Red" cases, the human experts only have to spend their time on the tricky, confusing examples.
  • The authors even built a special IDE Plugin (like a smart highlighter inside the coding software) to help these experts label the tricky cases quickly and consistently.

The Result: The SACS Dataset

By using this "Robot does the easy stuff, Human does the hard stuff" strategy, they created SACS (Semi-Automatic Code Smell dataset).

  • Scale: It's huge. It contains over 10,000 labeled examples for each of the three main types of smells (Long Method, Large Class, Feature Envy).
  • Quality: Because humans verified the tricky parts, the data is reliable enough to train advanced AI models.
  • Open Source: They released it to the public so other researchers can use it to build better tools for cleaning up software.

Why This Matters

Before this, researchers were stuck with tiny, expensive datasets that weren't good enough to train modern AI. Or they had huge datasets that were full of garbage.

This paper is like inventing a hybrid car for data creation. It uses the speed of a machine to generate volume and the wisdom of a human to ensure quality. Now, AI researchers have a massive, high-quality "textbook" of code mistakes to learn from, which will help them build better tools to automatically fix messy software in the future.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →