|
| 1 | +# Codee Report Analyzer |
| 2 | + |
| 3 | +Analyze Codee reports over time and generate interactive HTML visualizations. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This script analyzes multiple Codee reports, tracking how checker findings evolve over time. |
| 8 | +It supports both JSON and HTML report formats and generates an interactive HTML dashboard with three |
| 9 | +charts: |
| 10 | + |
| 11 | +- **Total Findings Over Time**: Line chart showing total findings per report |
| 12 | +- **Findings by Checker**: Line chart for each unique checker type found |
| 13 | +- **Findings by Priority Level**: Line chart grouped by L1/L2/L3/L4 priority |
| 14 | + |
| 15 | +## Requirements |
| 16 | + |
| 17 | +- Python 3.10+ |
| 18 | +- pandas |
| 19 | + |
| 20 | +## Installation |
| 21 | + |
| 22 | +```bash |
| 23 | +pip install pandas |
| 24 | +``` |
| 25 | + |
| 26 | +## Usage |
| 27 | + |
| 28 | +### Basic Usage |
| 29 | + |
| 30 | +```bash |
| 31 | +python analyze_codee_reports.py <input_directory> <output_directory> |
| 32 | +``` |
| 33 | + |
| 34 | +### Input Formats |
| 35 | + |
| 36 | +The script automatically detects the input format: |
| 37 | + |
| 38 | +**JSON Reports** (from `codee checks --json`): |
| 39 | +- Searches recursively for `*.json` files |
| 40 | +- Example directory structure: |
| 41 | + ``` |
| 42 | + reports/ |
| 43 | + ├── screening-1.json |
| 44 | + ├── screening-2.json |
| 45 | + └── subdir/ |
| 46 | + └── screening-3.json |
| 47 | + ``` |
| 48 | + |
| 49 | +**HTML Reports** (from `codee --html`): |
| 50 | +- Searches recursively for `report.js` files |
| 51 | +- When HTML reports are found, the generated dashboard includes links to open each original report |
| 52 | +- Example directory structure: |
| 53 | + ``` |
| 54 | + reports/ |
| 55 | + ├── run-2024-01-01/ |
| 56 | + │ ├── report.js |
| 57 | + │ └── ... |
| 58 | + └── run-2024-02-01/ |
| 59 | + ├── report.js |
| 60 | + └── ... |
| 61 | + ``` |
| 62 | + |
| 63 | +## Dashboard Features |
| 64 | + |
| 65 | +The generated HTML dashboard includes: |
| 66 | + |
| 67 | +- **Interactive charts**: Hover for tooltips, click on points to open original reports |
| 68 | +- **Summary cards**: Show report count, unique checkers found, and the total findings from the latest report |
| 69 | +- **Links section**: Table with links to open each original HTML report |
| 70 | +- **Responsive design**: Works on desktop and mobile |
| 71 | +- **No external dependencies**: Uses Chart.js from CDN (internet required for first load) |
| 72 | + |
| 73 | +## Understanding the Charts |
| 74 | + |
| 75 | +### Total Findings |
| 76 | +Shows the sum of all checker findings for each report over time. Click on any point to open the original report (if available). |
| 77 | + |
| 78 | +### Findings by Checker |
| 79 | +Displays each unique checker type (e.g., PWR007, PWR068) as a separate line, allowing you to see which specific checkers contribute to findings. |
| 80 | + |
| 81 | +### Findings by Priority Level |
| 82 | +Groups findings by their severity level: |
| 83 | +- **L1** (Red): Highest priority - correctness issues |
| 84 | +- **L2** (Orange): Medium-high priority |
| 85 | +- **L3** (Green): Medium priority |
| 86 | +- **L4** (Light Green): Lower priority |
| 87 | + |
| 88 | +## Troubleshooting |
| 89 | + |
| 90 | +### "No JSON/HTML files found" |
| 91 | +- Ensure your input directory contains valid report files |
| 92 | +- For JSON: look for `*.json` files |
| 93 | +- For HTML: look for directories containing `report.js` |
| 94 | + |
| 95 | +### "Malformed JSON/JS" |
| 96 | +- One or more files are corrupted |
| 97 | +- The script will skip these files and continue |
| 98 | + |
| 99 | +### "No valid timestamp" |
| 100 | +- Some files may be missing the timestamp field |
| 101 | +- The script will skip these files and continue |
0 commit comments