Conversation
Fetches PR data via gh CLI and generates an interactive HTML dashboard with stacked bar, line, and doughnut charts. Includes contributor filter checkboxes to show/hide individual team members.
Paragon SummaryThis pull request review identified 2 issues across 2 categories in 2 files. The review analyzed code changes, potential bugs, security vulnerabilities, performance issues, and code quality concerns using automated analysis tools. This PR adds a Python script that generates an interactive HTML dashboard visualizing PR activity data via stacked bar charts, line charts, doughnut charts, and a contributor leaderboard with live filtering by team member. The generated report file is excluded from git to keep the repository clean. Key changes:
Confidence score: 3/5
2 files reviewed, 2 comments Severity breakdown: High: 1, Low: 1 Tip: |
| weekly: dict[str, dict[str, int]] = defaultdict(lambda: defaultdict(int)) | ||
| authors: set[str] = set() | ||
|
|
||
| for pr in prs: |
There was a problem hiding this comment.
Security: Null author crash when PR author deleted their account
Null author crash when PR author deleted their account. Any repo with historical PRs from deleted users will crash entirely. Guard with safe navigation before accessing login.
View Details
Location: scripts/pr-stats/generate.py (lines 328)
Analysis
Null author crash when PR author deleted their account
| What fails | GitHub returns 'author': null for PRs from deleted accounts; the code unconditionally accesses pr['author']['login'] causing a TypeError crash. |
| Result | TypeError: 'NoneType' object is not subscriptable — no report is generated |
| Expected | Script should handle null authors gracefully (e.g. attribute them to '[deleted]') and continue generating the report |
| Impact | Any repository with even one historical PR from a deleted account causes the entire report generation to fail with no output. |
How to reproduce
1. Have a repo with at least one PR from a deleted GitHub account
2. Run: python scripts/pr-stats/generate.py
3. Observe crash in build_report()Patch Details
- author = pr["author"]["login"]
+ author = (pr.get("author") or {}).get("login") or "[deleted]"AI Fix Prompt
Fix this issue: Null author crash when PR author deleted their account. Any repo with historical PRs from deleted users will crash entirely. Guard with safe navigation before accessing login.
Location: scripts/pr-stats/generate.py (lines 328)
Problem: GitHub returns 'author': null for PRs from deleted accounts; the code unconditionally accesses pr['author']['login'] causing a TypeError crash.
Current behavior: TypeError: 'NoneType' object is not subscriptable — no report is generated
Expected: Script should handle null authors gracefully (e.g. attribute them to '[deleted]') and continue generating the report
Steps to reproduce: 1. Have a repo with at least one PR from a deleted GitHub account
2. Run: python scripts/pr-stats/generate.py
3. Observe crash in build_report()
Provide a code fix.
Tip: Reply with @paragon-run to automatically fix this issue
Dynamically fetch the repo name via gh CLI instead of hardcoding it.
Summary
scripts/pr-stats/generate.py— fetches PR data viaghCLI and generates an interactive HTML dashboardpython scripts/pr-stats/generate.py --openreport.htmlis gitignoredTest plan
python scripts/pr-stats/generate.py --openand verify the report opens in browserscripts/pr-stats/report.htmldoes not appear ingit status