chore(lint): exclude unused-receiver for adapters and fix split tests
- commit
- 03f2d9abcc84de03bd60f74caf7b6068132b1b02
- author
- brice · · 2025-12-22 06:12 UTC
- parent
- 187bf45
- signature
- unsigned
2 files · +11 -15
M .golangci.yml +5 -0
| @@ -158,6 +158,11 @@ linters: | |||
| 158 | 158 | text: "unused-receiver" | |
| 159 | 159 | linters: | |
| 160 | 160 | - revive | |
| 161 | + | # Adapter structs intentionally keep receivers for interface compliance | |
| 162 | + | - path: internal/infrastructure/.*adapter\.go | |
| 163 | + | text: "unused-receiver" | |
| 164 | + | linters: | |
| 165 | + | - revive | |
| 161 | 166 | ||
| 162 | 167 | run: | |
| 163 | 168 | timeout: 20m | |
| @@ -158,6 +158,11 @@ linters: | |||||
| 158 | text: "unused-receiver" | 158 | text: "unused-receiver" | ||
| 159 | linters: | 159 | linters: | ||
| 160 | - revive | 160 | - revive | ||
| 161 | + | # Adapter structs intentionally keep receivers for interface compliance | |||
| 162 | + | - path: internal/infrastructure/.*adapter\.go | |||
| 163 | + | text: "unused-receiver" | |||
| 164 | + | linters: | |||
| 165 | + | - revive | |||
| 161 | 166 | ||||
| 162 | run: | 167 | run: | ||
| 163 | timeout: 20m | 168 | timeout: 20m | ||
M internal/ui/layout/split_test.go +6 -15
| @@ -81,6 +81,9 @@ func TestNewSplitView_Vertical(t *testing.T) { | |||
| 81 | 81 | // Assert | |
| 82 | 82 | require.NotNil(t, sv) | |
| 83 | 83 | assert.Equal(t, layout.OrientationVertical, sv.Orientation()) | |
| 84 | + | assert.InEpsilon(t, 0.5, sv.GetRatio(), 0.0001) | |
| 85 | + | assert.Equal(t, mockStartChild, sv.StartChild()) | |
| 86 | + | assert.Equal(t, mockEndChild, sv.EndChild()) | |
| 84 | 87 | } | |
| 85 | 88 | ||
| 86 | 89 | func TestNewSplitView_NilChildren(t *testing.T) { | |
| @@ -131,11 +134,7 @@ func TestSetRatio_ValidRange(t *testing.T) { | |||
| 131 | 134 | sv.SetRatio(tt.input) | |
| 132 | 135 | ||
| 133 | 136 | // Assert | |
| 134 | - | if tt.expected == 0.0 { | |
| 135 | - | assert.Equal(t, tt.expected, sv.GetRatio()) | |
| 136 | - | } else { | |
| 137 | - | assert.InEpsilon(t, tt.expected, sv.GetRatio(), 0.0001) | |
| 138 | - | } | |
| 137 | + | assert.InEpsilon(t, tt.expected, sv.GetRatio(), 0.0001) | |
| 139 | 138 | }) | |
| 140 | 139 | } | |
| 141 | 140 | } | |
| @@ -168,11 +167,7 @@ func TestSetRatio_OutOfRange_Clamped(t *testing.T) { | |||
| 168 | 167 | sv.SetRatio(tt.input) | |
| 169 | 168 | ||
| 170 | 169 | // Assert | |
| 171 | - | if tt.expected == 0.0 { | |
| 172 | - | assert.Equal(t, tt.expected, sv.GetRatio()) | |
| 173 | - | } else { | |
| 174 | - | assert.InEpsilon(t, tt.expected, sv.GetRatio(), 0.0001) | |
| 175 | - | } | |
| 170 | + | assert.InEpsilon(t, tt.expected, sv.GetRatio(), 0.0001) | |
| 176 | 171 | }) | |
| 177 | 172 | } | |
| 178 | 173 | } | |
| @@ -376,11 +371,7 @@ func TestNewSplitView_InitialRatio_Clamped(t *testing.T) { | |||
| 376 | 371 | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, tt.input) | |
| 377 | 372 | ||
| 378 | 373 | // Assert | |
| 379 | - | if tt.expected == 0.0 { | |
| 380 | - | assert.Equal(t, tt.expected, sv.GetRatio()) | |
| 381 | - | } else { | |
| 382 | - | assert.InEpsilon(t, tt.expected, sv.GetRatio(), 0.0001) | |
| 383 | - | } | |
| 374 | + | assert.InEpsilon(t, tt.expected, sv.GetRatio(), 0.0001) | |
| 384 | 375 | }) | |
| 385 | 376 | } | |
| 386 | 377 | } | |
| @@ -81,6 +81,9 @@ func TestNewSplitView_Vertical(t *testing.T) { | |||||
| 81 | // Assert | 81 | // Assert | ||
| 82 | require.NotNil(t, sv) | 82 | require.NotNil(t, sv) | ||
| 83 | assert.Equal(t, layout.OrientationVertical, sv.Orientation()) | 83 | assert.Equal(t, layout.OrientationVertical, sv.Orientation()) | ||
| 84 | + | assert.InEpsilon(t, 0.5, sv.GetRatio(), 0.0001) | |||
| 85 | + | assert.Equal(t, mockStartChild, sv.StartChild()) | |||
| 86 | + | assert.Equal(t, mockEndChild, sv.EndChild()) | |||
| 84 | } | 87 | } | ||
| 85 | 88 | ||||
| 86 | func TestNewSplitView_NilChildren(t *testing.T) { | 89 | func TestNewSplitView_NilChildren(t *testing.T) { | ||
| @@ -131,11 +134,7 @@ func TestSetRatio_ValidRange(t *testing.T) { | |||||
| 131 | sv.SetRatio(tt.input) | 134 | sv.SetRatio(tt.input) | ||
| 132 | 135 | ||||
| 133 | // Assert | 136 | // Assert | ||
| 134 | - | if tt.expected == 0.0 { | 137 | + | assert.InEpsilon(t, tt.expected, sv.GetRatio(), 0.0001) |
| 135 | - | assert.Equal(t, tt.expected, sv.GetRatio()) | |||
| 136 | - | } else { | |||
| 137 | - | assert.InEpsilon(t, tt.expected, sv.GetRatio(), 0.0001) | |||
| 138 | - | } | |||
| 139 | }) | 138 | }) | ||
| 140 | } | 139 | } | ||
| 141 | } | 140 | } | ||
| @@ -168,11 +167,7 @@ func TestSetRatio_OutOfRange_Clamped(t *testing.T) { | |||||
| 168 | sv.SetRatio(tt.input) | 167 | sv.SetRatio(tt.input) | ||
| 169 | 168 | ||||
| 170 | // Assert | 169 | // Assert | ||
| 171 | - | if tt.expected == 0.0 { | 170 | + | assert.InEpsilon(t, tt.expected, sv.GetRatio(), 0.0001) |
| 172 | - | assert.Equal(t, tt.expected, sv.GetRatio()) | |||
| 173 | - | } else { | |||
| 174 | - | assert.InEpsilon(t, tt.expected, sv.GetRatio(), 0.0001) | |||
| 175 | - | } | |||
| 176 | }) | 171 | }) | ||
| 177 | } | 172 | } | ||
| 178 | } | 173 | } | ||
| @@ -376,11 +371,7 @@ func TestNewSplitView_InitialRatio_Clamped(t *testing.T) { | |||||
| 376 | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, tt.input) | 371 | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, tt.input) | ||
| 377 | 372 | ||||
| 378 | // Assert | 373 | // Assert | ||
| 379 | - | if tt.expected == 0.0 { | 374 | + | assert.InEpsilon(t, tt.expected, sv.GetRatio(), 0.0001) |
| 380 | - | assert.Equal(t, tt.expected, sv.GetRatio()) | |||
| 381 | - | } else { | |||
| 382 | - | assert.InEpsilon(t, tt.expected, sv.GetRatio(), 0.0001) | |||
| 383 | - | } | |||
| 384 | }) | 375 | }) | ||
| 385 | } | 376 | } | ||
| 386 | } | 377 | } | ||