Welcome to the AI Code Reviewer repository! This project provides an AI-powered tool for reviewing code files and providing actionable feedback to fix bugs, improve application speed, and fix security problems.
- Automated code review for various programming languages.
- In-depth suggestions for improving code quality.
- Simple command-line interface for ease of use.
- Fix Calculate Circumference - https://youtu.be/gjapO5D0guk
- Fix copy and paste bug - https://youtu.be/YdeEu7ofzV4
Each example below is exercised by an automated integration test in
CodeReviewExamplesIT, which sends the
buggy source to a local Ollama model and asserts the review flags the known bug. Run them yourself with
./gradlew integrationTest (requires Ollama running locally; excluded from the default test task since it
makes live model calls).
Mutation testing uses PIT: run ./gradlew pitest and open
build/reports/pitest/index.html. It runs the unit tests only; the Ollama integration tests are excluded.
- Used the wrong collection java code output
- Buggy algorithm java code output
- Inefficient String concatenation java code output
- Hardcoded constant instead of PI java code output
- Swapped fields in constructor java code output
- Copy paste bug in constructor java code output
Before running the AI Code Reviewer, you need to install and set up the following dependencies:
-
Java 17
The build is pinned to a Java 17 toolchain. The Gradle wrapper will auto-provision a JDK 17 if one isn't already installed, but running the built.jardirectly requires Java 17+ on yourPATH. -
Ollama, running locally
The AI Code Reviewer depends on Ollama being installed and running (ollama serve, or the Ollama desktop app) athttp://localhost:11434— that URL is hardcoded in the app. -
AI Models
Install the following AI models via Ollama:gemma2llama3.1llama3.2qwen2.5-coderfalcon3
Download and install Java from https://www.java.com if it is not already installed on your system.
Follow the instructions at Ollama's official site to install it locally, then make sure it's running:
ollama serveOnce Ollama is installed, add the required models:
ollama pull gemma2
ollama pull llama3.1
ollama pull llama3.2
ollama pull qwen2.5-coder
ollama pull falcon3Clone this repository to your local machine:
git clone https://github.com/larrydiamond/AICodeReviewer.git
cd AICodeReviewerBuild the jar with the Gradle wrapper (no local Gradle install needed):
./gradlew buildThis produces build/libs/dli-0.1.0.jar.
Run the AI Code Reviewer using the following command:
java -jar build/libs/dli-0.1.0.jar <filename_to_review>Replace <filename_to_review> with the path to the file you want to review. For example:
java -jar build/libs/dli-0.1.0.jar src/MyCodeFile.javaThe AI Code Reviewer will analyze the provided file and output suggestions directly in the terminal, highlighting areas for improvement, potential bugs, and optimization tips.
We welcome contributions! If you would like to contribute to the AI Code Reviewer project:
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name. - Commit your changes:
git commit -m "Add feature". - Push to the branch:
git push origin feature-name. - Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
If you encounter any issues or have questions, please open an issue in the repository
Happy coding and reviewing! 🚀