Skip to content

Commit ec56b72

Browse files
committed
refactor: update golangci-lint action to v9 and adjust theme pointer usage in shell and anime results
1 parent 5b2e1b1 commit ec56b72

7 files changed

Lines changed: 22 additions & 16 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
run: go mod download
7272

7373
- name: Run golangci-lint
74-
uses: golangci/golangci-lint-action@v8
74+
uses: golangci/golangci-lint-action@v9
7575
with:
7676
version: latest
7777

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
go mod download
4141
4242
- name: Run linter
43-
uses: golangci/golangci-lint-action@v8
43+
uses: golangci/golangci-lint-action@v9
4444
with:
4545
version: latest
4646

@@ -622,4 +622,4 @@ jobs:
622622
echo "" >> $GITHUB_STEP_SUMMARY
623623
echo "- Package: goanime" >> $GITHUB_STEP_SUMMARY
624624
echo "- Version: ${{ steps.version.outputs.VERSION_NUMBER }}" >> $GITHUB_STEP_SUMMARY
625-
echo "- AUR URL: https://aur.archlinux.org/packages/goanime" >> $GITHUB_STEP_SUMMARY
625+
echo "- AUR URL: https://aur.archlinux.org/packages/goanime" >> $GITHUB_STEP_SUMMARY

internal/tui/anime_results.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ type animeResultsModel struct {
9696
// newAnimeResultsModel creates the styled, filterable anime result screen.
9797
func newAnimeResultsModel(animes []*models.Anime) *animeResultsModel {
9898
theme := NewTheme(true)
99-
shell := NewShell(theme, "Search > Results")
99+
shell := NewShell(&theme, "Search > Results")
100100
items := make([]list.Item, 0, len(animes))
101101
for _, anime := range animes {
102102
if anime == nil {
@@ -222,7 +222,7 @@ func (m *animeResultsModel) View() tea.View {
222222
quality = value
223223
}
224224
}
225-
details := renderAnimeDetails(m.theme, name, source, year, mediaType, quality)
225+
details := renderAnimeDetails(&m.theme, name, source, year, mediaType, quality)
226226
frameWidth, frameHeight := m.theme.Panel.GetFrameSize()
227227
panel := m.theme.Panel.
228228
Width(max(panelWidth-frameWidth, 1)).
@@ -239,7 +239,7 @@ func (m *animeResultsModel) View() tea.View {
239239
}
240240

241241
// renderAnimeDetails composes styled lines without JoinVertical's unstyled padding.
242-
func renderAnimeDetails(theme Theme, name, source, year, mediaType, quality string) string {
242+
func renderAnimeDetails(theme *Theme, name, source, year, mediaType, quality string) string {
243243
return strings.Join([]string{
244244
theme.Primary.Render("Details"),
245245
"",

internal/tui/anime_results_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ func TestRenderAnimeDetails(t *testing.T) {
284284
t.Parallel()
285285

286286
theme := NewTheme(true)
287-
details := renderAnimeDetails(theme, "The Boys", "SuperFlix", "2019", "tv", "—")
287+
details := renderAnimeDetails(&theme, "The Boys", "SuperFlix", "2019", "tv", "—")
288288

289289
assert.Contains(t, details, "Details")
290290
assert.Contains(t, details, "The Boys")

internal/tui/program_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
// minimalModel is the simplest possible Bubble Tea model for construction tests.
1212
type minimalModel struct{}
1313

14-
func (m minimalModel) Init() tea.Cmd { return nil }
14+
func (m minimalModel) Init() tea.Cmd { return nil }
1515
func (m minimalModel) Update(tea.Msg) (tea.Model, tea.Cmd) { return m, nil }
1616
func (m minimalModel) View() tea.View { return tea.NewView("") }
1717

internal/tui/shell.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ type Shell struct {
2222
}
2323

2424
// NewShell creates a shell with safe dimensions before the first resize event.
25-
func NewShell(theme Theme, breadcrumb string) Shell {
25+
func NewShell(theme *Theme, breadcrumb string) Shell {
2626
return Shell{
27-
Theme: theme,
27+
Theme: *theme,
2828
Breadcrumb: breadcrumb,
2929
Width: defaultShellWidth,
3030
Height: defaultShellHeight,
@@ -38,7 +38,7 @@ func (s *Shell) Resize(width, height int) {
3838
}
3939

4040
// ContentSize returns space left after header, separators, and footer.
41-
func (s Shell) ContentSize() (int, int) {
41+
func (s *Shell) ContentSize() (int, int) {
4242
width := s.Width
4343
if width <= 0 {
4444
width = defaultShellWidth
@@ -51,7 +51,7 @@ func (s Shell) ContentSize() (int, int) {
5151
}
5252

5353
// Render wraps body content in responsive navigation chrome.
54-
func (s Shell) Render(body, footer string) string {
54+
func (s *Shell) Render(body, footer string) string {
5555
width, height := s.ContentSize()
5656
header := s.Theme.Header.Render("GOANIME")
5757
if width >= 34 && s.Breadcrumb != "" {

internal/tui/shell_test.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,16 @@ import (
88
"github.com/stretchr/testify/assert"
99
)
1010

11+
// newTestShell builds a shell over an addressable test theme.
12+
func newTestShell(breadcrumb string) Shell {
13+
theme := NewTheme(true)
14+
return NewShell(&theme, breadcrumb)
15+
}
16+
1117
func TestNewShell(t *testing.T) {
1218
t.Parallel()
1319

14-
shell := NewShell(NewTheme(true), "Search > Results")
20+
shell := newTestShell("Search > Results")
1521

1622
assert.Equal(t, defaultShellWidth, shell.Width)
1723
assert.Equal(t, defaultShellHeight, shell.Height)
@@ -34,7 +40,7 @@ func TestShellResize(t *testing.T) {
3440
for _, tt := range tests {
3541
t.Run(tt.name, func(t *testing.T) {
3642
t.Parallel()
37-
shell := NewShell(NewTheme(true), "")
43+
shell := newTestShell("")
3844
shell.Resize(tt.width, tt.height)
3945
assert.Equal(t, tt.wantWidth, shell.Width)
4046
assert.Equal(t, tt.wantHeight, shell.Height)
@@ -121,7 +127,7 @@ func TestShellRender(t *testing.T) {
121127
for _, tt := range tests {
122128
t.Run(tt.name, func(t *testing.T) {
123129
t.Parallel()
124-
shell := NewShell(NewTheme(true), "Search > Results")
130+
shell := newTestShell("Search > Results")
125131
shell.Resize(tt.width, 24)
126132

127133
got := shell.Render("BODY", "↑↓ navigate / filter")
@@ -141,7 +147,7 @@ func TestShellRender(t *testing.T) {
141147
width int
142148
height int
143149
}{{1, 5}, {8, 5}, {20, 6}, {33, 8}, {80, 12}} {
144-
shell := NewShell(NewTheme(true), strings.Repeat("long breadcrumb ", 20))
150+
shell := newTestShell(strings.Repeat("long breadcrumb ", 20))
145151
shell.Resize(size.width, size.height)
146152
body := strings.Repeat("very long body ", 20) + "\n" + strings.Repeat("extra line\n", 20)
147153

0 commit comments

Comments
 (0)