
Code-SNIFF-AI is a shell script that automatically reviews code changes. GIT DIFF is used to extract the changed contents for certain file formats, and a review of the changed code through the API.
code-sniff-ai
├── .env
├── .env.sample
├── .gitignore
├── README.md
├── example
│ ├── javascript
│ │ └── HelloWorld.js
│ └── python
│ └── hello_world.py
└── run-review.sh
Create .env file by referring to .env.sample file and set the necessary environment variables.
This script requires jq . If jq is not installed, you can install it using the following command.
Ubuntu/Linux :
sudo apt-get install jqMacOS :
brew install jq Windows : You can download and use jq.exe from the JQ official release page. Save the downloaded files to the appropriate path and add the path to the system path.
git add .run-review.sh Script to perform code reviews for stained files. ./run-review.shThis script should be run on the root directory of the Git repository and reviews the changes staged in the git.
Basically, we review the file of the following extension. You can set it up as an environment variable as needed.
example/javascript/HelloWorld.js file contains a simple JavaScript class example.
class HelloWorld {
constructor ( ) {
this . message = "Hello, World!" ;
}
sayHello ( ) {
console . log ( this . message ) ;
}
} This code is " sayHello , World!" This is a simple class that outputs a message to the console.
example/python/hello_world.py file contains a simple python class example.
class HelloWorld :
def __init__ ( self ):
self . message = 'Hello, World!'
def say_hello ( self ):
print ( self . message )
if __name__ == "__main__" :
hello = HelloWorld ()
hello . say_hello () This code is " say_hello , World!" This is a simple class that outputs a message to the console.
The model you want to use in Ollama must be downloaded using the ollama pull command in advance. For example, to use the gemma2 model, run the command below to download the model:
ollama pull gemma2 We are studying how to integrate code-sniff-ai into Git Workflow to make code review automation more efficient. For example, we are seeking ways to automatically trigger code reviews when pushing to a specific branch, or to run automatic reviews when creating PR. Such integration can improve the development process by including it in the CI/CD pipeline.
We are studying the possibility of applying prompt engineering to improve the accuracy and quality of code reviews. We are experimenting with various prompt configuration measures so that the AI model can provide more sophisticated feedback, which will maximize the efficiency of the code review process.
If you want to contribute, fork the project, create a new branch, reflect the changes, and submit a full request.
This project was given a license with MIT license.