A lightweight AI-based code debugging and static analysis tool that analyzes Python source code, detects common issues, and provides useful suggestions to improve code quality.
AI Code Debugger is a command-line application designed to help developers identify common Python coding problems without manually checking every line.
The application uses Python's built-in ast module to validate Python syntax and performs additional static checks on the source code.
It is simple, beginner-friendly, and can be extended with AI/LLM capabilities in the future.
- 🔍 Detects code syntax errors
- 🧠 Performs basic static code analysis
- 📏 Detects unnecessarily long lines
⚠️ Identifies possible unintended comparison usage- 🐛 Detects debug
print()statements - 💡 Provides suggestions for fixing detected issues
- 💻 Simple command-line interface
- 🚀 Easy to run and extend
- OPEN AI
- AST (Abstract Syntax Tree)
- Command Line Interface (CLI)
AI-Code-Debugger/
│
├── app.py
├── requirements.txt
├── README.md
└── .gitignore
Contains the main debugging and static-analysis logic.
Contains project dependencies.
This project currently uses Python's built-in
astmodule, so no external Python packages are required.
Contains project documentation and instructions for running the application.
The application follows these steps:
User enters Python code
↓
Code is collected through CLI
↓
Python AST syntax validation
↓
Static code analysis
↓
Issues are detected
↓
Suggestions are generated
↓
Analysis report is displayed
git clone https://github.com/YOUR-USERNAME/AI-Code-Debugger.gitcd AI-Code-DebuggerWindows:
python -m venv venv
venv\Scripts\activateLinux/macOS:
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtSince the project currently uses only Python's standard library, there are no external dependencies.
Run:
python app.pyYou will see:
=== AI Code Debugger ===
Paste your Python code. Type END on a new line to finish.
Enter your Python code and type:
END
when you are finished.
def calculate_sum(a, b)
print(a + b)
calculate_sum(10, 20)
END--- Analysis Report ---
Issues Found:
- Syntax Error: expected ':'
Suggestions:
- Check the reported line and fix syntax issues.
Input:
x = 10
if x == 10:
print("Debugging")The debugger can provide suggestions such as:
Suggestions:
- Line 4: Remove debug print statements before production deployment.
This project can be useful for:
- Python beginners learning debugging
- Students practicing programming
- Identifying simple syntax errors
- Basic static code analysis
- Learning how AST-based analysis works
- Building a foundation for an AI-powered coding assistant
The project can be extended with:
- 🤖 OpenAI/LLM-based code explanations
- 🔧 Automatic code correction
- 📊 Code quality scoring
- 🖥️ Web interface using Streamlit or Flask
- 📁 Upload Python files for analysis
- 📝 Detailed error explanations
- 🔍 More advanced static analysis rules
- 💬 Natural-language debugging assistance
- 🧪 Automated test generation
- 🔐 Secure sandboxed code execution
Contributions are welcome.
- Fork the repository
- Create a new branch
- Make your changes
- Commit your changes
- Push your branch
- Create a Pull Request
This project is open-source and available under the MIT License.
Jetty Usha Rani
Computer Science Student
Mohan Babu University
⭐ If you find this project useful, consider giving the repository a star!