[cite_start]This project aims to automate code reviews by analyzing the structure, readability, and best practices of source code files[cite: 51]. [cite_start]It leverages a Large Language Model (LLM) to provide actionable improvement suggestions[cite: 55].
- Input: Accepts one or more source code files for analysis[cite: 54].
- Output: Generates a detailed review report containing suggestions for improvement[cite: 55].
- Web Interface: Includes an optional simple dashboard to upload files and view the generated reports[cite: 56].
- Backend: A backend API built with Python and Flask receives the code files for processing[cite: 58].
- LLM Integration: Utilizes Google's Generative AI to perform the code analysis[cite: 59].
- Secure API Key Handling: API keys are loaded from a local
.envfile to prevent exposure in the public repository[cite: 19].
Follow these steps to set up and run the project on your local machine.
- Python 3.8 or higher
- A Google API Key for the Gemini API
Clone this public GitHub repository to your local machine[cite: 6, 8].
git clone [https://github.com/Abhilesh-Vaka/code-review-assistant.git](https://github.com/Abhilesh-Vaka/code-review-assistant.git)
cd code-review-assistantIt is recommended to use a virtual environment. [cite_start]The project is designed with minimal dependencies as required[cite: 27].
# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate # On macOS/Linux
# venv\Scripts\activate # On Windows
# Install the required packages
pip install -r requirements.txtTo protect sensitive information, the API key must not be hard-coded[cite: 19].
-
Create a file named
.envin the root directory of the project. [cite_start]This file is intentionally excluded from version control by.gitignore[cite: 19]. -
Add your Google API key to the
.envfile as follows:GOOGLE_API_KEY="YOUR_API_KEY_HERE"
Start the Flask server with the following command:
python app.pyThe application should now be running without errors at http://127.0.0.1:5000[cite: 29].
- Open your web browser and navigate to
http://127.0.0.1:5000. - Use the form to select a source code file from your computer.
- Click the "Get Review" button.
- The review report generated by the LLM will appear on the page.
This submission meets the following deliverable requirements:
- GitHub Repository: This public repository on the
mainbranch contains all project code and a README file.