detached 03f2d9a

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:
158158 text: "unused-receiver"
159159 linters:
160160 - revive
161+ # Adapter structs intentionally keep receivers for interface compliance
162+ - path: internal/infrastructure/.*adapter\.go
163+ text: "unused-receiver"
164+ linters:
165+ - revive
161166
162167 run:
163168 timeout: 20m
@@ -158,6 +158,11 @@ linters:
158 text: "unused-receiver"158 text: "unused-receiver"
159 linters:159 linters:
160 - revive160 - 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: 20m168 timeout: 20m
M internal/ui/layout/split_test.go +6 -15
@@ -81,6 +81,9 @@ func TestNewSplitView_Vertical(t *testing.T) {
8181 // Assert
8282 require.NotNil(t, sv)
8383 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())
8487 }
8588
8689 func TestNewSplitView_NilChildren(t *testing.T) {
@@ -131,11 +134,7 @@ func TestSetRatio_ValidRange(t *testing.T) {
131134 sv.SetRatio(tt.input)
132135
133136 // 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)
139138 })
140139 }
141140 }
@@ -168,11 +167,7 @@ func TestSetRatio_OutOfRange_Clamped(t *testing.T) {
168167 sv.SetRatio(tt.input)
169168
170169 // 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)
176171 })
177172 }
178173 }
@@ -376,11 +371,7 @@ func TestNewSplitView_InitialRatio_Clamped(t *testing.T) {
376371 sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, tt.input)
377372
378373 // 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)
384375 })
385376 }
386377 }
@@ -81,6 +81,9 @@ func TestNewSplitView_Vertical(t *testing.T) {
81 // Assert81 // 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 // Assert136 // 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 // Assert169 // 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 // Assert373 // 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 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close