A web-based tool for code review and improvement suggestions, supporting Python and Java. Analyze your code for quality, security, and get AI-powered suggestions and answers to custom questions.
- Monaco Editor: Write or paste code with syntax highlighting (Python, Java).
- Multi-Language Support: Analyze Python (pylint, bandit) and Java (Checkstyle) code.
- Security Checks: Detect security issues in Python code (bandit).
- AI Suggestions: Get improvement tips from OpenAI (GPT-3.5 Turbo).
- Custom AI Prompt: Ask the AI specific questions about your code.
- REST API:
/analyzeendpoint for code analysis.
Code Review Assistant/
│
├── backend/
│ ├── app.py # Flask API server
│ ├── analysis.py # Analysis logic (pylint, bandit, Checkstyle, OpenAI)
│ └── requirements.txt # Python dependencies
│
└── frontend/
├── index.html # Main UI (Monaco Editor, controls)
├── style.css # Styling
└── app.js # Frontend logic
Place the project in your desired directory
- Open a terminal and navigate to the backend folder:
cd "P:\Py\Code Review Assistant\backend" pip install -r requirements.txt
- Run the Flask server:
python app.py
- The backend will run at
http://127.0.0.1:5000/
- Open
frontend/index.htmlin your web browser. - (Optional) Use a local server or VS Code Live Server for best results.
- Install Checkstyle and ensure it's in your system PATH.
- Download a config file (e.g.,
google_checks.xml) and place it in an accessible location. - Edit
analysis.pyif you need to change the Checkstyle config path.
- Set your OpenAI API key as an environment variable before running the backend:
- On Windows (PowerShell):
$env:OPENAI_API_KEY="your-openai-api-key"
- On Mac/Linux:
export OPENAI_API_KEY="your-openai-api-key"
- On Windows (PowerShell):
- The backend will read the key from the environment. Do NOT hardcode your API key in the code or upload it to GitHub.
-
Start the backend:
cd "P:\Py\Code Review Assistant\backend" python app.py
You should see:
* Running on http://127.0.0.1:5000/ -
Open the frontend:
- Go to the
frontendfolder. - Double-click
index.htmlto open it in your browser.
- Go to the
-
Select Python from the language dropdown.
-
(Optional) Enter a custom AI prompt (e.g.,
How can I make this code faster?). -
Paste this code in the editor:
def add_numbers(a, b): return a + b print(add_numbers(2, 3))
-
Click "Analyze Code".
-
View the results in the Output Panel:
- Quality: Code issues (from pylint)
- Security: Security warnings (from bandit)
- Suggestions: AI-powered improvement tips
- AI Response: The answer to your custom question (if you asked one)
-
Select Java from the language dropdown.
-
(Optional) Enter a custom AI prompt (e.g.,
Is this code following best practices?). -
Paste this code in the editor:
public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }
-
Click "Analyze Code".
-
View the results in the Output Panel:
- Quality: Java code issues (from Checkstyle, if installed)
- Security: (Not implemented for Java, will show a message)
- Suggestions: AI-powered tips for Java
- AI Response: The answer to your custom question
- If you see errors about Checkstyle, you may need to install it for Java support.
- If you get an OpenAI error, check your internet connection and API key.
- If the backend isn't running, the frontend won't get results—make sure the Flask server is started.
- Endpoint:
POST /analyze - Request JSON:
{ "code": "<your code>", "language": "python" | "java", "prompt": "<optional custom question>" } - Response JSON:
{ "quality": ["..."], "security": ["..."], "suggestions": ["..."], "custom_ai_response": "..." }