Skip to content

Commit cb2fb4d

Browse files
committed
lint: Cleared remaining linter issues
1 parent b43ead6 commit cb2fb4d

4 files changed

Lines changed: 14 additions & 16 deletions

File tree

internal/ui/components/jobdetail/jobdetail.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -204,26 +204,26 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
204204

205205
case key.Matches(msg, m.KeyMap.LineUp):
206206
if m.focusRight {
207-
m.rightYOffset = clampInt(m.rightYOffset-1, 0, m.maxRightYOffset())
207+
m.rightYOffset = clampZeroMax(m.rightYOffset-1, m.maxRightYOffset())
208208
} else {
209-
m.leftYOffset = clampInt(m.leftYOffset-1, 0, m.maxLeftYOffset())
209+
m.leftYOffset = clampZeroMax(m.leftYOffset-1, m.maxLeftYOffset())
210210
}
211211

212212
case key.Matches(msg, m.KeyMap.LineDown):
213213
if m.focusRight {
214-
m.rightYOffset = clampInt(m.rightYOffset+1, 0, m.maxRightYOffset())
214+
m.rightYOffset = clampZeroMax(m.rightYOffset+1, m.maxRightYOffset())
215215
} else {
216-
m.leftYOffset = clampInt(m.leftYOffset+1, 0, m.maxLeftYOffset())
216+
m.leftYOffset = clampZeroMax(m.leftYOffset+1, m.maxLeftYOffset())
217217
}
218218

219219
case key.Matches(msg, m.KeyMap.ScrollLeft):
220220
if m.focusRight {
221-
m.rightXOffset = clampInt(m.rightXOffset-4, 0, m.maxRightXOffset())
221+
m.rightXOffset = clampZeroMax(m.rightXOffset-4, m.maxRightXOffset())
222222
}
223223

224224
case key.Matches(msg, m.KeyMap.ScrollRight):
225225
if m.focusRight {
226-
m.rightXOffset = clampInt(m.rightXOffset+4, 0, m.maxRightXOffset())
226+
m.rightXOffset = clampZeroMax(m.rightXOffset+4, m.maxRightXOffset())
227227
}
228228

229229
case key.Matches(msg, m.KeyMap.GotoTop):
@@ -302,12 +302,12 @@ func (m Model) maxRightXOffset() int {
302302
return maxX
303303
}
304304

305-
func clampInt(value, min, max int) int {
306-
if value < min {
307-
return min
305+
func clampZeroMax(value, maxValue int) int {
306+
if value < 0 {
307+
return 0
308308
}
309-
if value > max {
310-
return max
309+
if value > maxValue {
310+
return maxValue
311311
}
312312
return value
313313
}

internal/ui/components/jobsbox/jobsbox.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ func (m Model) View() string {
156156
// Split content into lines
157157
lines := strings.Split(m.content, "\n")
158158

159-
var middleLines []string
160159
contentHeight := height - 2 // minus top and bottom borders
160+
middleLines := make([]string, 0, contentHeight)
161161

162162
for i := range contentHeight {
163163
var line string

internal/ui/components/messagebox/messagebox.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (m Model) View() string {
145145
vBarRight := m.styles.Border.Render(border.Right)
146146

147147
contentHeight := height - 2 // minus top and bottom borders
148-
var middleLines []string
148+
middleLines := make([]string, 0, contentHeight)
149149

150150
// Center the message vertically
151151
msgText := m.styles.Muted.Render(m.message)

internal/ui/views/dashboard.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,7 @@ func (d *Dashboard) adjustFocusedPane(delta int) (View, tea.Cmd) {
165165
switch d.focusedPane {
166166
case dashboardPaneRealtime:
167167
next := max(d.realtimeInterval+delta, 5)
168-
if next > 20 {
169-
next = 20
170-
}
168+
next = min(next, 20)
171169
if next != d.realtimeInterval {
172170
d.realtimeInterval = next
173171
d.tickID++

0 commit comments

Comments
 (0)