Skip to content

Commit ac4980b

Browse files
authored
Merge pull request #21 from tstromberg/main
Fix Ready to Review branding, lint issues
2 parents 094ea72 + 0268a35 commit ac4980b

File tree

7 files changed

+23
-22
lines changed

7 files changed

+23
-22
lines changed

cmd/prcost/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ func main() {
3535
days := flag.Int("days", 60, "Number of days to look back for PR modifications")
3636

3737
// Modeling flags
38-
targetMergeTime := flag.Duration("target-merge-time", 90*time.Minute, "Target merge time for efficiency modeling (default: 90 minutes / 1.5 hours)")
38+
targetMergeTime := flag.Duration("target-merge-time", 90*time.Minute,
39+
"Target merge time for efficiency modeling (default: 90 minutes / 1.5 hours)")
3940

4041
flag.Usage = func() {
4142
fmt.Fprintf(os.Stderr, "Usage: %s [options] <PR_URL>\n", os.Args[0])

cmd/prcost/repository.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import (
1414
// analyzeRepository performs repository-wide cost analysis by sampling PRs.
1515
// Uses library functions from pkg/github and pkg/cost for fetching, sampling,
1616
// and extrapolation - all functionality is available to external clients.
17-
//
18-
//nolint:revive // argument-limit: acceptable for entry point function
1917
func analyzeRepository(ctx context.Context, owner, repo string, sampleSize, days int, cfg cost.Config, token, dataSource string) error {
2018
// Calculate since date
2119
since := time.Now().AddDate(0, 0, -days)
@@ -113,8 +111,6 @@ func analyzeRepository(ctx context.Context, owner, repo string, sampleSize, days
113111
// analyzeOrganization performs organization-wide cost analysis by sampling PRs across all repos.
114112
// Uses library functions from pkg/github and pkg/cost for fetching, sampling,
115113
// and extrapolation - all functionality is available to external clients.
116-
//
117-
//nolint:revive // argument-limit: acceptable for entry point function
118114
func analyzeOrganization(ctx context.Context, org string, sampleSize, days int, cfg cost.Config, token, dataSource string) error {
119115
slog.Info("Fetching PR list from organization")
120116

internal/server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ func (s *Server) SetDataSource(source string) {
313313
s.logger.InfoContext(ctx, "Data source configured", "source", source)
314314
}
315315

316-
// SetR2RCallout enables or disables the Ready-to-Review promotional callout.
316+
// SetR2RCallout enables or disables the Ready to Review promotional callout.
317317
func (s *Server) SetR2RCallout(enabled bool) {
318318
s.r2rCallout = enabled
319319
}

internal/server/static/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This directory contains static assets for the prcost web UI, including JavaScrip
66

77
Key functions are extracted into separate `.js` files for testing purposes:
88

9-
- `formatR2RCallout.js` - Renders the Ready-to-Review savings callout
9+
- `formatR2RCallout.js` - Renders the Ready to Review savings callout
1010
- `formatR2RCallout.test.js` - Tests for the callout rendering
1111

1212
### Running Tests
@@ -24,7 +24,7 @@ make test
2424
The JavaScript tests verify:
2525
- Correct rendering of the savings callout HTML
2626
- Proper formatting of dollar amounts ($50K, $2.5M, etc.)
27-
- Presence of key messaging ("Pro-Tip:", "Ready-to-Review", etc.)
27+
- Presence of key messaging ("Pro-Tip:", "Ready to Review", etc.)
2828
- Correct behavior for fast PRs (no callout for ≤1 hour)
2929
- HTML structure and styling
3030

internal/server/static/formatR2RCallout.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ function formatR2RCallout(avgOpenHours, r2rSavings, currentEfficiency, modeledEf
2626

2727
let html = '<div style="margin: 24px 0; padding: 12px 20px; background: linear-gradient(135deg, #e6f9f0 0%, #ffffff 100%); border: 1px solid #00c853; border-radius: 8px; font-size: 14px; color: #1d1d1f; line-height: 1.6;">';
2828
html += 'Pro-Tip: Save <strong>' + savingsText + '/yr</strong> in lost development effort by reducing merge times to &lt;' + targetText + ' with ';
29-
html += '<a href="https://codegroove.dev/" target="_blank" rel="noopener" style="color: #00c853; font-weight: 600; text-decoration: none;">Ready-to-Review</a>. ';
30-
html += 'Free for OSS, cheap for everyone else.';
29+
html += '<a href="https://codegroove.dev/products/ready-to-review/" target="_blank" rel="noopener" style="color: #00c853; font-weight: 600; text-decoration: none;">Ready to Review</a>. ';
30+
html += 'Free for open-source repositories, $6/user/org for private repos.';
3131
html += '</div>';
3232
return html;
3333
}

internal/server/static/formatR2RCallout.test.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,18 @@ test('Contains "Pro-Tip:" text', () => {
3838
assert(result.includes('Pro-Tip:'), 'Should contain "Pro-Tip:"');
3939
});
4040

41-
// Test 4: Should contain "Ready-to-Review" link
42-
test('Contains "Ready-to-Review" link', () => {
41+
// Test 4: Should contain "Ready to Review" link
42+
test('Contains "Ready to Review" link', () => {
4343
const result = formatR2RCallout(10, 50000, 60, 70);
44-
assert(result.includes('Ready-to-Review'), 'Should contain "Ready-to-Review"');
45-
assert(result.includes('href="https://codegroove.dev/"'), 'Should link to codegroove.dev');
44+
assert(result.includes('Ready to Review'), 'Should contain "Ready to Review"');
45+
assert(result.includes('href="https://codegroove.dev/products/ready-to-review/"'), 'Should link to Ready to Review page');
4646
});
4747

4848
// Test 5: Should contain OSS pricing message
4949
test('Contains OSS pricing message', () => {
5050
const result = formatR2RCallout(10, 50000, 60, 70);
51-
assert(result.includes('Free for OSS, cheap for everyone else'), 'Should contain OSS pricing message');
51+
assert(result.includes('Free for open-source repositories'), 'Should contain OSS pricing message');
52+
assert(result.includes('$6/user/org for private repos'), 'Should contain private repo pricing');
5253
});
5354

5455
// Test 6: Should format savings in thousands (K)

internal/server/static/index.html

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,7 +1421,7 @@ <h3>Why calculate PR costs?</h3>
14211421
html += `<span style="font-size: 28px; font-weight: 700; color: #1d1d1f;">${efficiencyPct.toFixed(1)}%</span>`;
14221422
html += '</div>';
14231423
html += `<div class="efficiency-message">${message}</div>`;
1424-
html += '<div style="font-size: 11px; color: #86868b; margin-top: 4px;">Expected costs minus delay costs</div>';
1424+
html += '<div style="font-size: 11px; color: #86868b; margin-top: 4px;">Time spent coding vs. waiting</div>';
14251425
html += '</div>'; // Close efficiency-box
14261426

14271427
// Merge Velocity box
@@ -1452,9 +1452,9 @@ <h3>Why calculate PR costs?</h3>
14521452
return html;
14531453
}
14541454

1455-
function formatR2RCallout(avgOpenHours, r2rSavings, currentEfficiency, modeledEfficiency) {
1456-
// Only show if average merge velocity is > 1 hour
1457-
if (avgOpenHours <= 1) {
1455+
function formatR2RCallout(avgOpenHours, r2rSavings, currentEfficiency, modeledEfficiency, targetMergeHours = 1.5) {
1456+
// Only show if average merge velocity is > target
1457+
if (avgOpenHours <= targetMergeHours) {
14581458
return '';
14591459
}
14601460

@@ -1474,10 +1474,13 @@ <h3>Why calculate PR costs?</h3>
14741474
throughputText = ' (+' + efficiencyDelta.toFixed(1) + '% throughput)';
14751475
}
14761476

1477+
// Format target merge time
1478+
let targetText = targetMergeHours.toFixed(1) + 'h';
1479+
14771480
let html = '<div style="margin: 24px 0; padding: 12px 20px; background: linear-gradient(135deg, #e6f9f0 0%, #ffffff 100%); border: 1px solid #00c853; border-radius: 8px; font-size: 14px; color: #1d1d1f; line-height: 1.6;">';
1478-
html += 'Pro-Tip: Save <strong>' + savingsText + '/yr</strong> in lost development effort by reducing merge times to &lt;1h with ';
1479-
html += '<a href="https://codegroove.dev/" target="_blank" rel="noopener" style="color: #00c853; font-weight: 600; text-decoration: none;">Ready-to-Review</a>. ';
1480-
html += 'Free for OSS, cheap for everyone else.';
1481+
html += 'Pro-Tip: Save <strong>' + savingsText + '/yr</strong> in lost development effort by reducing merge times to &lt;' + targetText + ' with ';
1482+
html += '<a href="https://codegroove.dev/products/ready-to-review/" target="_blank" rel="noopener" style="color: #00c853; font-weight: 600; text-decoration: none;">Ready to Review</a>. ';
1483+
html += 'Free for open-source repositories, $6/user/org for private repos.';
14811484
html += '</div>';
14821485
return html;
14831486
}

0 commit comments

Comments
 (0)