Skip to content

AI Code Review Assistant that combines AST analysis, ML classification, and GPT-4 to automatically detect code smells and generate intelligent refactoring suggestions! #AI #Python #CodeReview

Notifications You must be signed in to change notification settings

floreaGabriel/code_review_assistant

Repository files navigation

🔍 AI Code Review Assistant

An intelligent, automated code review tool that combines Abstract Syntax Tree (AST) analysis, Machine Learning classification, and Large Language Model-powered suggestions to detect code smells and provide actionable refactoring advice.

Python Streamlit OpenAI License

✨ Features

  • 🔬 AST-Based Detection - Static code analysis using Python's Abstract Syntax Tree to identify anti-patterns
  • 🤖 ML-Powered Classification - Scikit-Learn Logistic Regression model classifies issue severity (Low/Medium/High)
  • 💡 AI-Generated Suggestions - OpenAI GPT-4 provides contextual, educational refactoring recommendations
  • 🎨 Interactive UI - Beautiful Streamlit interface with syntax highlighting and real-time feedback
  • ⚡ Fast & Accurate - Analyzes code in seconds with configurable detection thresholds

Interface

1

2

3

4

🎯 Detected Code Smells

  • Long Functions - Functions exceeding recommended line counts
  • Too Many Parameters - Functions with excessive parameter lists
  • God Classes - Classes with too many responsibilities
  • Complex Conditions - Overly nested or complex conditional logic
  • Deep Nesting - Excessive indentation levels

🚀 Quick Start

Prerequisites

  • Python 3.11 or higher
  • OpenAI API key

📊 How It Works

  1. AST Parsing - Code is parsed into an Abstract Syntax Tree
  2. Pattern Matching - Tree traversal identifies anti-patterns
  3. Feature Extraction - Metrics extracted for ML classification
  4. Severity Prediction - Logistic Regression classifies issue severity
  5. AI Suggestion - GPT-4 generates contextual refactoring advice

🎓 Educational Value

This tool not only identifies problems but teaches best practices by:

  • Explaining WHY code smells are problematic
  • Providing before/after code examples
  • Referencing SOLID principles and design patterns
  • Offering constructive, educational feedback

About

AI Code Review Assistant that combines AST analysis, ML classification, and GPT-4 to automatically detect code smells and generate intelligent refactoring suggestions! #AI #Python #CodeReview

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages