CodeDog can automatically review your code commits and send the review results via email. This guide explains how to set up and use this feature.
-
Install Git Hooks
Run the following command to set up the git hooks that will trigger automatic code reviews when you make commits:
python run_codedog.py setup-hooks
This will install a post-commit hook in your repository's
.git/hooksdirectory. -
Configure Email Notifications
To receive email notifications with the review results, you need to configure email settings. You have two options:
a) Using Environment Variables:
Add the following to your
.envfile:# Email notification settings EMAIL_ENABLED="true" NOTIFICATION_EMAILS="your.email@example.com" # Can be comma-separated for multiple recipients # SMTP server settings SMTP_SERVER="smtp.gmail.com" # Use your email provider's SMTP server SMTP_PORT="587" # Common port for TLS connections SMTP_USERNAME="your.email@gmail.com" # The email that will send notifications SMTP_PASSWORD="your_app_password" # See Gmail-specific instructions in docs/email_setup.mdb) Default Email:
If you don't configure any email settings, the system will automatically send review results to
kratosxie@gmail.com. -
Configure LLM Models
You can specify which models to use for different parts of the review process:
# Model selection (optional) CODE_SUMMARY_MODEL="gpt-3.5" PR_SUMMARY_MODEL="gpt-4" CODE_REVIEW_MODEL="gpt-3.5"
- When you make a commit, the post-commit hook automatically runs.
- The hook executes
run_codedog_commit.pywith your commit hash. - The script:
- Retrieves information about your commit
- Analyzes the code changes
- Generates a summary and review
- Saves the review to a file named
codedog_commit_<commit_hash>.md - Sends the review via email to the configured address(es)
You can also manually run the commit review script:
python run_codedog_commit.py --commit <commit-hash> --verbose--commit: Specify the commit hash to review (defaults to HEAD)--repo: Path to git repository (defaults to current directory)--email: Email addresses to send the report to (comma-separated)--output: Output file path (defaults to codedog_commit_.md)--model: Model to use for code review--summary-model: Model to use for PR summary--verbose: Enable verbose output
If you're not receiving email notifications:
- Check that
EMAIL_ENABLEDis set to "true" in your.envfile - Verify your SMTP settings (see Email Setup Guide)
- Make sure your email provider allows sending emails via SMTP
- Check your spam/junk folder
If the review isn't running automatically:
- Verify that the git hook was installed correctly:
cat .git/hooks/post-commit
- Make sure the hook is executable:
chmod +x .git/hooks/post-commit
- Try running the script manually to see if there are any errors
The review report includes:
- A summary of the commit
- Analysis of the code changes
- Suggestions for improvements
- Potential issues or bugs
- Code quality feedback
The report is formatted in Markdown and sent as both plain text and HTML in the email.