This directory contains example files and data for testing the PatchPro bot.
src/- Example Python files with various code issuesartifact/analysis/- Sample JSON output from Ruff and Semgrep analyzers
The example files contain various types of issues that PatchPro can detect and fix:
- Shell Injection (CWE-78): Using
subprocess.call()withshell=True - Weak Cryptography (CWE-327): Using MD5 hash algorithm
- Exception Handling: Catching broad exceptions before specific ones
- F401: Unused imports
- F841: Unused variables
- E501: Line too long
- B007: Loop control variable not used
To test the PatchPro bot with this example:
-
Set your OpenAI API key:
export OPENAI_API_KEY="your-api-key-here"
-
Run the agent core:
cd examples python -m patchpro_bot.agent_core
Or use the example as a test case in your development workflow.
The bot should generate:
- Unified diff patches for each file
- A comprehensive report in
artifact/report.md - Individual or combined patch files in
artifact/
Main example file containing:
- Unused import (
os) - Long line (E501)
- Security vulnerability (shell injection)
- Insecure hash usage
Utility functions with:
- Unused variables
- Loop control issues
- Bad exception handling order
- More security issues
ruff_output.json: Sample Ruff analyzer outputsemgrep_output.json: Sample Semgrep analyzer output
These JSON files represent what would typically be generated by running:
ruff check --output-format json examples/src/ > artifact/analysis/ruff_output.json
semgrep --config=auto --json examples/src/ > artifact/analysis/semgrep_output.json