blob: e2c56a517c8fb6606404123d4046c99809caf719 (
plain) (
tree)
|
|
# GitHub PR Review Analyzer
A tool to analyze pull request review patterns in a GitHub repository, focusing on team members' review behaviors and habits. This tool helps teams understand and improve their code review processes by providing insights into review frequency, speed, thoroughness, and approval patterns.
## Usage
### Basic Usage
```bash
# Basic usage with default date range (last month)
pr-analyze --token=your_github_token --repo=owner/repo
# Specify custom date range
pr-analyze --token=your_github_token --repo=owner/repo --start=2024-01-01 --end=2024-03-31
# Use with GitHub Enterprise
# Option 1: Include /api/v3 in the URL
pr-analyze --token=your_github_token --repo=owner/repo --api-url=https://github.company.com/api/v3
# Option 2: Let the tool add /api/v3 automatically
pr-analyze --token=your_github_token --repo=owner/repo --api-url=https://github.company.com
```
### Required Flags
- `--token`: Your GitHub personal access token (required)
- `--repo`: Repository in owner/repo format (required)
### Optional Flags
- `--start`: Start date in YYYY-MM-DD format (default: 1 month ago)
- `--end`: End date in YYYY-MM-DD format (default: today)
- `--api-url`: GitHub API URL (default: https://api.github.com)
- For GitHub Enterprise, use your instance URL (e.g., https://github.company.com)
- The tool will automatically add /api/v3 if needed
## GitHub Enterprise Support
When using this tool with GitHub Enterprise:
1. Make sure you have the correct permissions:
- `repo` scope for private repositories
- `read:org` scope for organization repositories
1. The API URL can be specified in two ways:
- Full URL with /api/v3: `https://github.company.com/api/v3`
- Base URL: `https://github.company.com` (the tool will add /api/v3)
1. Common issues and solutions:
- "Not Found" error: Check that the repository path is correct and you have access
- "Unauthorized" error: Verify your token has the correct permissions
- "Rate limit exceeded": Wait for the rate limit to reset or use a token with higher limits
## Metrics Explained
The tool analyzes and presents the following metrics for each team member:
1. **PRs Reviewed**
- Total number of pull requests reviewed by the team member
- Helps identify active reviewers and potential bottlenecks
1. **Average Review Speed**
- Time from PR creation to first comment
- Measured in hours
- Lower values indicate faster initial feedback
1. **Average Comments per File**
- Number of inline comments made per file when reviewing
- Higher values suggest more thorough reviews
- Only counted when comments are present
1. **Immediate Approvals**
- Percentage of PRs approved without requesting changes
- Helps understand review patterns and potential quality trade-offs
## Output Format
The tool generates a table showing metrics for each team member:
```
GitHub PR Review Analysis for owner/repo (Jan 1, 2024 - Mar 31, 2024)
-----------------------------------------------------------------------
Team Member | PRs Reviewed | Avg Review Speed | Avg Comments/File | Immediate Approvals
-----------------------------------------------------------------------
dev1 | 24 | 4.2 hours | 1.8 | 25%
dev2 | 18 | 2.1 hours | 0.9 | 78%
dev3 | 32 | 8.5 hours | 3.2 | 12%
-----------------------------------------------------------------------
```
|