Skip to content

Commit 777b8ec

Browse files
committed
lint
1 parent 703f965 commit 777b8ec

9 files changed

Lines changed: 491 additions & 700 deletions

File tree

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ linters:
128128
enable-all: true
129129
disabled-checks:
130130
- paramTypeCombine
131+
- rangeValCopy # PRSummary struct (152 bytes) copies are acceptable for code clarity
131132
# The list of supported checkers can be found at https://go-critic.com/overview.
132133
settings:
133134
captLocal:

cmd/prcost/repository.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@ import (
1515
// Uses library functions from pkg/github and pkg/cost for fetching, sampling,
1616
// and extrapolation - all functionality is available to external clients.
1717
func analyzeRepository(ctx context.Context, owner, repo string, sampleSize, days int, cfg cost.Config, token, dataSource string) error {
18+
// Create GitHub client without caching (for CLI)
19+
client := github.NewClientWithoutCache()
20+
1821
// Calculate since date
1922
since := time.Now().AddDate(0, 0, -days)
2023

2124
// Fetch all PRs modified since the date using library function
22-
prs, _, err := github.FetchPRsFromRepo(ctx, owner, repo, since, token, nil)
25+
prs, err := client.FetchPRsFromRepo(ctx, owner, repo, since, token, nil)
2326
if err != nil {
2427
return fmt.Errorf("failed to fetch PRs: %w", err)
2528
}
@@ -93,7 +96,7 @@ func analyzeRepository(ctx context.Context, owner, repo string, sampleSize, days
9396
totalAuthors := github.CountUniqueAuthors(prs)
9497

9598
// Query for actual count of open PRs (not extrapolated from samples)
96-
openPRCount, err := github.CountOpenPRsInRepo(ctx, owner, repo, token)
99+
openPRCount, err := client.CountOpenPRsInRepo(ctx, owner, repo, token)
97100
if err != nil {
98101
slog.Warn("Failed to count open PRs, using 0", "error", err)
99102
openPRCount = 0
@@ -128,13 +131,16 @@ func analyzeRepository(ctx context.Context, owner, repo string, sampleSize, days
128131
// Uses library functions from pkg/github and pkg/cost for fetching, sampling,
129132
// and extrapolation - all functionality is available to external clients.
130133
func analyzeOrganization(ctx context.Context, org string, sampleSize, days int, cfg cost.Config, token, dataSource string) error {
134+
// Create GitHub client without caching (for CLI)
135+
client := github.NewClientWithoutCache()
136+
131137
slog.Info("Fetching PR list from organization")
132138

133139
// Calculate since date
134140
since := time.Now().AddDate(0, 0, -days)
135141

136142
// Fetch all PRs across the org modified since the date using library function
137-
prs, _, err := github.FetchPRsFromOrg(ctx, org, since, token, nil)
143+
prs, err := client.FetchPRsFromOrg(ctx, org, since, token, nil)
138144
if err != nil {
139145
return fmt.Errorf("failed to fetch PRs: %w", err)
140146
}
@@ -208,7 +214,7 @@ func analyzeOrganization(ctx context.Context, org string, sampleSize, days int,
208214
totalAuthors := github.CountUniqueAuthors(prs)
209215

210216
// Count open PRs across the entire organization with a single query
211-
totalOpenPRs, err := github.CountOpenPRsInOrg(ctx, org, token)
217+
totalOpenPRs, err := client.CountOpenPRsInOrg(ctx, org, token)
212218
if err != nil {
213219
slog.Warn("Failed to count open PRs in organization, using 0", "error", err)
214220
totalOpenPRs = 0

go.mod

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
module github.com/codeGROOVE-dev/prcost
22

3-
go 1.25.3
3+
go 1.25.4
44

55
require (
6-
github.com/codeGROOVE-dev/ds9 v0.6.0
6+
github.com/codeGROOVE-dev/ds9 v0.7.1
77
github.com/codeGROOVE-dev/gsm v0.0.0-20251019065141-833fe2363d22
88
github.com/codeGROOVE-dev/prx v0.0.0-20251030022101-ff906928a1e4
99
github.com/codeGROOVE-dev/turnclient v0.0.0-20251030022425-bc3b14acf75e
1010
golang.org/x/time v0.14.0
1111
)
1212

13-
require github.com/codeGROOVE-dev/retry v1.3.0 // indirect
13+
require (
14+
github.com/codeGROOVE-dev/bdcache v0.5.0 // indirect
15+
github.com/codeGROOVE-dev/retry v1.3.0 // indirect
16+
)

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
github.com/codeGROOVE-dev/bdcache v0.5.0 h1:62Ns4QOdZ239LtytJDcO+kI4OOr+5SPh/ct81rGEEtY=
2+
github.com/codeGROOVE-dev/bdcache v0.5.0/go.mod h1:vZlNyKt4Zmse37T9wPZX+J3Kc2fjZlcGzXArQh5W4dc=
13
github.com/codeGROOVE-dev/ds9 v0.6.0 h1:JG7vBH17UAKaVoeQilrIvA1I0fg3iNbdUMBSDS7ixgI=
24
github.com/codeGROOVE-dev/ds9 v0.6.0/go.mod h1:0UDipxF1DADfqM5GtjefgB2u+EXdDgOKmxVvrSGLHoM=
5+
github.com/codeGROOVE-dev/ds9 v0.7.1 h1:UuffbTksanUPERBkOsiPOe46fkTJlzBOA9jUyfkBxEI=
6+
github.com/codeGROOVE-dev/ds9 v0.7.1/go.mod h1:0UDipxF1DADfqM5GtjefgB2u+EXdDgOKmxVvrSGLHoM=
37
github.com/codeGROOVE-dev/gsm v0.0.0-20251019065141-833fe2363d22 h1:gtN3rOc6YspO646BkcOxBhPjEqKUz+jl175jIqglfDg=
48
github.com/codeGROOVE-dev/gsm v0.0.0-20251019065141-833fe2363d22/go.mod h1:KV+w19ubP32PxZPE1hOtlCpTaNpF0Bpb32w5djO8UTg=
59
github.com/codeGROOVE-dev/prx v0.0.0-20251030022101-ff906928a1e4 h1:DSuoUwP3oyR4cHrX0cUh9c7CtYjXNIcyCmqpIwHilIU=

0 commit comments

Comments
 (0)