Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

Eliminates intermediate variable assignment where the value is used exactly once, per feedback on #139.

Changes:

  • Inline NewMockParams() call directly in assertion instead of storing in params variable

Before:

func TestNewMockParams_DisablesStats(t *testing.T) {
	params := NewMockParams()
	assert.False(t, params.Stats, "stats must be disabled")
}

After:

func TestNewMockParams_DisablesStats(t *testing.T) {
	assert.False(t, NewMockParams().Stats, "stats must be disabled")
}

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Address feedback on redundant variable in test for params.go Remove redundant variable in TestNewMockParams_DisablesStats Dec 15, 2025
Copilot AI requested a review from yegor256 December 15, 2025 09:22
@yegor256 yegor256 marked this pull request as ready for review December 15, 2025 13:20
Copilot AI review requested due to automatic review settings December 15, 2025 13:20
@yegor256 yegor256 merged commit 9a682e0 into 138.a Dec 15, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes an intermediate variable assignment in TestNewMockParams_DisablesStats by inlining the NewMockParams() call directly in the assertion. While the change reduces verbosity by eliminating a single-use variable, it introduces an inconsistency with the established pattern used throughout the test file.

Key Changes:

  • Inline NewMockParams() call directly in assertion instead of storing in intermediate variable

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

func TestNewMockParams_DisablesStats(t *testing.T) {
params := NewMockParams()
assert.False(t, params.Stats, "stats must be disabled")
assert.False(t, NewMockParams().Stats, "stats must be disabled")
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This inline style is inconsistent with all other test functions in this file (lines 11-94), which store the result of NewMockParams() in a params variable before making assertions. For consistency and maintainability, consider either keeping the original two-line pattern or updating all similar test functions to use the inline style.

Suggested change
assert.False(t, NewMockParams().Stats, "stats must be disabled")
params := NewMockParams()
assert.False(t, params.Stats, "stats must be disabled")

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants