Skip to content

Commit 4ce0ce2

Browse files
Copilotpelikhan
andauthored
rename isEmptyDiff to isEmptyFirewallDiff for clarity
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/d8a40454-719a-4040-8489-4e70e336adb7 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent d1fc823 commit 4ce0ce2

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

pkg/cli/audit_diff_render.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func renderAuditDiffPretty(diff *AuditDiff) {
5050
var summaryParts []string
5151
anomalyCount := 0
5252

53-
if diff.FirewallDiff != nil && !isEmptyDiff(diff.FirewallDiff) {
53+
if diff.FirewallDiff != nil && !isEmptyFirewallDiff(diff.FirewallDiff) {
5454
fwParts := []string{}
5555
if len(diff.FirewallDiff.NewDomains) > 0 {
5656
fwParts = append(fwParts, fmt.Sprintf("%d new domains", len(diff.FirewallDiff.NewDomains)))
@@ -102,7 +102,7 @@ func renderAuditDiffPretty(diff *AuditDiff) {
102102

103103
// renderFirewallDiffMarkdownSection renders the firewall diff sub-section as markdown
104104
func renderFirewallDiffMarkdownSection(diff *FirewallDiff) {
105-
if diff == nil || isEmptyDiff(diff) {
105+
if diff == nil || isEmptyFirewallDiff(diff) {
106106
return
107107
}
108108

@@ -232,7 +232,7 @@ func renderRunMetricsDiffMarkdownSection(run1ID, run2ID int64, diff *RunMetricsD
232232

233233
// renderFirewallDiffPrettySection renders the firewall diff as a pretty console sub-section
234234
func renderFirewallDiffPrettySection(diff *FirewallDiff) {
235-
if diff == nil || isEmptyDiff(diff) {
235+
if diff == nil || isEmptyFirewallDiff(diff) {
236236
return
237237
}
238238

@@ -370,8 +370,8 @@ func statusEmoji(status string) string {
370370
}
371371
}
372372

373-
// isEmptyDiff returns true if the firewall diff contains no changes
374-
func isEmptyDiff(diff *FirewallDiff) bool {
373+
// isEmptyFirewallDiff returns true if the firewall diff contains no changes
374+
func isEmptyFirewallDiff(diff *FirewallDiff) bool {
375375
return len(diff.NewDomains) == 0 &&
376376
len(diff.RemovedDomains) == 0 &&
377377
len(diff.StatusChanges) == 0 &&
@@ -387,7 +387,7 @@ func isEmptyMCPToolsDiff(diff *MCPToolsDiff) bool {
387387

388388
// isEmptyAuditDiff returns true if the audit diff contains no changes across all sections
389389
func isEmptyAuditDiff(diff *AuditDiff) bool {
390-
fwEmpty := diff.FirewallDiff == nil || isEmptyDiff(diff.FirewallDiff)
390+
fwEmpty := diff.FirewallDiff == nil || isEmptyFirewallDiff(diff.FirewallDiff)
391391
mcpEmpty := diff.MCPToolsDiff == nil || isEmptyMCPToolsDiff(diff.MCPToolsDiff)
392392
metricsEmpty := diff.RunMetricsDiff == nil
393393
return fwEmpty && mcpEmpty && metricsEmpty

pkg/cli/audit_diff_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,12 @@ func TestStatusEmoji(t *testing.T) {
306306

307307
func TestIsEmptyDiff(t *testing.T) {
308308
emptyDiff := &FirewallDiff{}
309-
assert.True(t, isEmptyDiff(emptyDiff), "Empty diff should be detected")
309+
assert.True(t, isEmptyFirewallDiff(emptyDiff), "Empty diff should be detected")
310310

311311
nonEmptyDiff := &FirewallDiff{
312312
NewDomains: []DomainDiffEntry{{Domain: "test.com"}},
313313
}
314-
assert.False(t, isEmptyDiff(nonEmptyDiff), "Non-empty diff should not be detected as empty")
314+
assert.False(t, isEmptyFirewallDiff(nonEmptyDiff), "Non-empty diff should not be detected as empty")
315315
}
316316

317317
// findDiffEntry is a test helper to find a domain in a list of diff entries

0 commit comments

Comments
 (0)