Skip to content

Abhilesh-Vaka/code-review-assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code Review Assistant 🤖

Objective

[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].

Scope and Features

  • 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].

Technical Implementation

  • 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 .env file to prevent exposure in the public repository[cite: 19].

Setup and Installation

Follow these steps to set up and run the project on your local machine.

1. Prerequisites

  • Python 3.8 or higher
  • A Google API Key for the Gemini API

2. Clone the Repository

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-assistant

3. Install Dependencies

It 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.txt

4. Set Up Environment Variables

To protect sensitive information, the API key must not be hard-coded[cite: 19].

  1. Create a file named .env in the root directory of the project. [cite_start]This file is intentionally excluded from version control by .gitignore[cite: 19].

  2. Add your Google API key to the .env file as follows:

    GOOGLE_API_KEY="YOUR_API_KEY_HERE"
    

5. Run the Application

Start the Flask server with the following command:

python app.py

The application should now be running without errors at http://127.0.0.1:5000[cite: 29].

How to Use

  1. Open your web browser and navigate to http://127.0.0.1:5000.
  2. Use the form to select a source code file from your computer.
  3. Click the "Get Review" button.
  4. The review report generated by the LLM will appear on the page.

Project Deliverables

This submission meets the following deliverable requirements:

  • GitHub Repository: This public repository on the main branch contains all project code and a README file.

About

An automated code review assistant powered by a Large Language Model. This tool analyzes source code for quality, readability, and potential bugs, providing actionable suggestions for improvement.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors