e20-4yp-Automated-Code-Smell-Detection-and-Refactoring-with-LLMs

SmellSense AI

Team

Supervisors


Table of Contents

  1. Introduction
  2. Research Problem
  3. Objectives
  4. Proposed Solution
  5. System Architecture
  6. Methodology
  7. Results
  8. Impact & Limitations
  9. Future Work
  10. Getting Started
  11. Links

Introduction

Modern software systems continue to grow rapidly in size and complexity. As projects evolve, maintaining clean and maintainable code becomes increasingly difficult. Poor coding practices often introduce code smells, which indicate deeper structural and maintainability issues within software systems.

SmellSense AI is a research-based intelligent system designed to automatically detect, explain, prioritize, and refactor code smells using a hybrid combination of static analysis, software metrics, and Large Language Models (LLMs).

The system provides an end-to-end workflow that assists developers in improving software quality and maintainability through intelligent automated refactoring.


Research Problem

Manual code smell detection is time-consuming, inconsistent, and difficult to scale across large software systems.

Traditional static analysis tools:

Standalone LLM-based approaches also introduce challenges such as:

SmellSense AI addresses these limitations through a hybrid intelligent pipeline.


Objectives

The primary objectives of the project are:


Proposed Solution

SmellSense AI introduces a fully integrated LLM-powered pipeline that:


System Architecture

The system consists of multiple integrated components working together to provide intelligent code analysis and refactoring support.

Main Components


Methodology

Methodology

The methodology consists of several major stages.

Data Acquisition

Data Acquisition

The dataset preparation process includes:

Code Smell Detection

Code Smell Detection

The detection process includes:

Smell Explanation & Prioritization

Prioritization

The prioritization engine:

Automated Refactoring

Automated Refactoring

The refactoring process includes:

Model Evaluation

Model Evaluation

Evaluation measures:

Chatbot Development

Chatbot Development

The chatbot interface enables users to:


Results

The proposed system demonstrates improvements over traditional tools and standalone LLM approaches.

Chatbot Interface Results

The chatbot interface acts as the primary interaction layer between the user and the backend analysis pipeline.

The workflow includes:

  1. User uploads or pastes source code
  2. Detection engines analyze the code
  3. Detected smells are consolidated
  4. Priority rankings are generated
  5. Refactoring suggestions are produced
  6. Results are displayed to the user

Initial Detection Results

The following interface demonstrates the initial analysis results generated after code submission.

Chatbot Result Interface - Initial Output

This interface displays:


Detailed Analysis and Refactoring Results

The following interface demonstrates detailed chatbot outputs after selecting detected smells and generated refactoring suggestions.

Chatbot Result Interface - Detailed Output

This interface displays:


Key Improvements


Impact & Limitations

Impact

Limitations


Future Work

Future improvements include:


Getting Started

Prerequisites


Run Backend

python -m backend.app.main
```

Backend API:

````text
http://localhost:8501

Run Frontend

streamlit run frontend/ui/chatbot_ui.py

Frontend UI:

http://localhost:8501