Skip to content

Commit 62a6c0c

Browse files
committed
Add --debug flag to print raw review data for diagnostics
1 parent 85734bb commit 62a6c0c

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

main.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ func main() {
1717
author := pflag.Bool("author", false, "Show your own PRs and their review status")
1818
limit := pflag.Int("limit", 500, "Maximum number of PRs to fetch")
1919
dismissRepos := pflag.StringSlice("dismiss-repos", nil, "Repos to hide (comma-separated)")
20+
debug := pflag.Bool("debug", false, "Print debug info for review classification")
2021
demo := pflag.Bool("demo", false, "Show demo data (for screenshots)")
2122
pflag.Parse()
2223

@@ -47,6 +48,10 @@ func main() {
4748
}
4849
}
4950

51+
if *debug {
52+
*plain = true
53+
}
54+
5055
if *plain {
5156
fmt.Fprintf(os.Stderr, "Fetching PRs for %s...\n", *org)
5257

@@ -56,12 +61,32 @@ func main() {
5661
os.Exit(1)
5762
}
5863

64+
if *debug {
65+
fmt.Fprintf(os.Stderr, "debug: authenticated as %q\n", me)
66+
}
67+
5968
prs, err := fetchOpenPRs(*org, *limit)
6069
if err != nil {
6170
fmt.Fprintf(os.Stderr, "error: %v\n", err)
6271
os.Exit(1)
6372
}
6473

74+
if *debug {
75+
fmt.Fprintf(os.Stderr, "debug: fetched %d PRs\n", len(prs))
76+
for _, pr := range prs {
77+
fmt.Fprintf(os.Stderr, "debug: %s#%d by %s — %d reviews\n",
78+
pr.Repository.Name, pr.Number, pr.Author.Login, len(pr.Reviews.Nodes))
79+
for _, r := range pr.Reviews.Nodes {
80+
fmt.Fprintf(os.Stderr, "debug: review by %q state=%q at %s\n",
81+
r.Author.Login, r.State, r.SubmittedAt.Format("2006-01-02T15:04:05Z"))
82+
}
83+
if len(pr.Commits.Nodes) > 0 {
84+
fmt.Fprintf(os.Stderr, "debug: last commit at %s\n",
85+
pr.Commits.Nodes[0].Commit.CommittedDate.Format("2006-01-02T15:04:05Z"))
86+
}
87+
}
88+
}
89+
6590
if *author {
6691
classified := classifyAllAuthor(prs, me, SortPriority)
6792
classified = filterDismissedRepos(classified, dismissedRepoSet)

0 commit comments

Comments
 (0)