A Python-based AI code review application designed to help developers identify potential security vulnerabilities, code quality issues, and possible improvements in their Python programs.
CodeGuard AI combines local static analysis with AI-powered code review through Google Gemini, providing developers with a convenient way to inspect code, understand findings, and improve their programming practices.
|
Dashboard |
Code Scan Results |
|
AI Code Review |
About |
CodeGuard AI is a Python application that helps developers review their source code through automated analysis and AI-generated recommendations.
The application uses local analysis tools to detect selected code quality and security issues. It can also use Google Gemini to provide additional explanations, suggestions, and code improvement recommendations.
Its interface is built with Streamlit and features a cybersecurity-inspired design with dark backgrounds and neon blue and purple accents.
CodeGuard AI is intended as a development aid for students, beginners, and programmers who want to improve their understanding of secure coding practices.
- ๐ Static Code Analysis using local analysis tools
- ๐ Security Checks with Bandit
- ๐งน Code Quality Checks with Ruff
- ๐ค AI-Powered Code Review using Google Gemini
- ๐จ Finding Severity Categories
- ๐ Detailed Scan Results
- ๐ง AI-Generated Explanations and Suggestions
- ๐ฏ Finding Filters for easier navigation
- ๐ Summary Cards for scan results
- ๐ฅ CSV Export for supported scan findings
- ๐ฅ๏ธ Streamlit Web Interface
- ๐ Dark Cybersecurity-Inspired Design
- ๐งช Automated Tests for supported analyzer functionality
Note: AI review requires a valid Gemini API key. AI suggestions and static-analysis findings should be reviewed before making changes to production code.
- Python 3.13+
- Streamlit
- Bandit
- Ruff
- Python pattern-based checks
- Google Gemini API
- Google Gen AI Python SDK
python-dotenv- Environment variables
pytest
- Visual Studio Code
- Git
- GitHub
- Python virtual environments
Replace the repository URL with your actual GitHub repository if necessary.
git clone https://github.com/your-username/CodeGuardAI.gitcd CodeGuardAIFor Python 3.13:
py -3.13 -m venv .venvFor Windows PowerShell:
.\.venv\Scripts\Activate.ps1If PowerShell blocks activation, allow scripts for the current terminal session:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\.venv\Scripts\Activate.ps1python -m pip install --upgrade pip
python -m pip install -r requirements.txtCreate a .env file in the project root directory.
GEMINI_API_KEY=your_gemini_api_key_hereIf the project uses a configurable Gemini model, you may also set:
GEMINI_MODEL=your_supported_gemini_modelUse a model supported by your Google AI Studio account and the installed SDK.
Important: Never upload your actual .env file or API key to GitHub. Keep .env in .gitignore and use .env.example to document the required configuration.
streamlit run app.pyStreamlit will display a local URL in the terminal. Open that URL in your browser to use CodeGuard AI.
- Open CodeGuard AI in your browser.
- Provide the Python code you want to review using the available interface.
- Run the local code analysis.
- Review the detected findings and their severity categories.
- Use the AI review feature for additional explanations and recommendations.
- Filter findings to focus on specific issues.
- Export supported scan results to CSV when needed.
- Review the suggested improvements and verify them before applying changes.
- ๐ฅ๏ธ Dashboard: Main application interface and scan overview.
- ๐ Code Analyzer: Runs local checks and collects findings.
- ๐ Security Analysis: Uses Bandit to identify supported Python security issues.
- ๐งน Code Quality Analysis: Uses Ruff to report supported linting findings.
- ๐ค AI Reviewer: Requests additional code-review insights from Google Gemini.
- ๐ Results Interface: Displays findings, severity information, and filters.
- ๐ฅ CSV Export: Exports supported scan findings.
- ๐งช Tests: Checks supported analyzer functionality.
CodeGuardAI/
โ
โโโ app.py
โโโ analyzer.py
โโโ ai_reviewer.py
โโโ requirements.txt
โโโ .env.example
โโโ .gitignore
โโโ README.md
โโโ CONTRIBUTING.md
โ
โโโ tests/
โ โโโ test_analyzer.py
โ
โโโ images/
โโโ Dashboard.png
โโโ Scan Results.png
โโโ AI Review.png
โโโ About.png
The images/ directory is optional until screenshots are added. Keep the structure consistent with the actual files in your repository.
CodeGuard AI is a supporting tool, not a replacement for professional security testing or manual code review.
- Do not assume that a clean scan means code is completely secure.
- Review all findings before changing your code.
- Verify AI-generated recommendations before using them.
- Avoid submitting API keys, passwords, tokens, personal information, or confidential source code to an external AI service.
- Understand that code submitted for AI review may be sent to the configured provider for processing.
- Keep your dependencies and development tools updated.
Potential improvements include:
- Support for additional programming languages
- More static-analysis integrations
- Improved finding explanations
- Before-and-after code comparisons
- Severity-based sorting and advanced filters
- Downloadable PDF reports
- Scan history and report management
- Custom security rules
- GitHub repository integration
- Continuous integration support
- Unit-test generation suggestions
- Improved AI model configuration
These are possible future additions, not necessarily features available in the current version.
Rheil Evans T. Lunio
Computer Science Student
University of Science and Technology of Southern Philippines (USTP)
Contributions, suggestions, bug reports, and feature improvements are welcome.
Please read CONTRIBUTING.md for instructions on contributing to the project.
This project is licensed under the MIT License. See the LICENSE file for more details.