From cce848148cbea9e1bc5ca7d2c3d1ef89702db0e4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 31 Mar 2025 14:15:13 -0300 Subject: [PATCH 1/2] ci: sync golangci-lint config (#770) Co-authored-by: caarlos0 <245435+caarlos0@users.noreply.github.com> --- .golangci.yml | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 90c5c08..7c0a115 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,17 +1,6 @@ +version: "2" run: tests: false - -issues: - include: - - EXC0001 - - EXC0005 - - EXC0011 - - EXC0012 - - EXC0013 - - max-issues-per-linter: 0 - max-same-issues: 0 - linters: enable: - bodyclose @@ -19,8 +8,6 @@ linters: - goconst - godot - godox - - gofumpt - - goimports - gomoddirectives - goprintffuncname - gosec @@ -39,3 +26,24 @@ linters: - unparam - whitespace - wrapcheck + exclusions: + generated: lax + presets: + - common-false-positives + paths: + - third_party$ + - builtin$ + - examples$ +issues: + max-issues-per-linter: 0 + max-same-issues: 0 +formatters: + enable: + - gofumpt + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ From bd2a5b0c6a7abc66b8a009d2aded233e6ba02fa4 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Mon, 31 Mar 2025 14:18:18 -0300 Subject: [PATCH 2/2] fix: golangci-lint 2 fixes (#769) --- bubbles.go | 3 +++ cursor/cursor.go | 1 + filepicker/filepicker.go | 2 ++ help/help.go | 1 + list/list.go | 2 +- progress/progress.go | 1 + spinner/spinner.go | 1 + table/table.go | 1 + textarea/memoization/memoization.go | 2 ++ textarea/textarea.go | 2 ++ textinput/textinput.go | 21 +++++++++++++++------ viewport/keymap.go | 2 ++ viewport/viewport.go | 2 +- 13 files changed, 33 insertions(+), 8 deletions(-) diff --git a/bubbles.go b/bubbles.go index 9b9e8d4..52af450 100644 --- a/bubbles.go +++ b/bubbles.go @@ -1 +1,4 @@ +// Package bubbles provides some components for Bubble Tea applications. These +// components are used in production in Glow, Charm and many other +// applications. package bubbles diff --git a/cursor/cursor.go b/cursor/cursor.go index 1297422..d101332 100644 --- a/cursor/cursor.go +++ b/cursor/cursor.go @@ -1,3 +1,4 @@ +// Package cursor provides cursor functionality for Bubble Tea applications. package cursor import ( diff --git a/filepicker/filepicker.go b/filepicker/filepicker.go index 487ca96..3898742 100644 --- a/filepicker/filepicker.go +++ b/filepicker/filepicker.go @@ -1,3 +1,5 @@ +// Package filepicker provides a file picker component for Bubble Tea +// applications. package filepicker import ( diff --git a/help/help.go b/help/help.go index 85afbee..bb402a6 100644 --- a/help/help.go +++ b/help/help.go @@ -1,3 +1,4 @@ +// Package help provides a simple help view for Bubble Tea applications. package help import ( diff --git a/list/list.go b/list/list.go index 9e3cd03..a96dc77 100644 --- a/list/list.go +++ b/list/list.go @@ -289,7 +289,7 @@ func (m *Model) SetFilterText(filter string) { m.updateKeybindings() } -// Helper method for setting the filtering state manually. +// SetFilterState allows setting the filtering state manually. func (m *Model) SetFilterState(state FilterState) { m.Paginator.Page = 0 m.cursor = 0 diff --git a/progress/progress.go b/progress/progress.go index b5d9f34..82f5eb0 100644 --- a/progress/progress.go +++ b/progress/progress.go @@ -1,3 +1,4 @@ +// Package progress provides a simple progress bar for Bubble Tea applications. package progress import ( diff --git a/spinner/spinner.go b/spinner/spinner.go index ac6e34a..b2d24b0 100644 --- a/spinner/spinner.go +++ b/spinner/spinner.go @@ -1,3 +1,4 @@ +// Package spinner provides a spinner component for Bubble Tea applications. package spinner import ( diff --git a/table/table.go b/table/table.go index 86151f6..ed29d8c 100644 --- a/table/table.go +++ b/table/table.go @@ -1,3 +1,4 @@ +// Package table provides a simple table component for Bubble Tea applications. package table import ( diff --git a/textarea/memoization/memoization.go b/textarea/memoization/memoization.go index ccb80a9..07f3796 100644 --- a/textarea/memoization/memoization.go +++ b/textarea/memoization/memoization.go @@ -1,3 +1,5 @@ +// Package memoization is an internal package that provides a simple memoization +// for text area. package memoization import ( diff --git a/textarea/textarea.go b/textarea/textarea.go index 9af8402..620201c 100644 --- a/textarea/textarea.go +++ b/textarea/textarea.go @@ -1,3 +1,5 @@ +// Package textarea provides a multi-line text input component for Bubble Tea +// applications. package textarea import ( diff --git a/textinput/textinput.go b/textinput/textinput.go index 4c5c10d..84cbbc9 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -1,3 +1,5 @@ +// Package textinput provides a text input component for Bubble Tea +// applications. package textinput import ( @@ -760,15 +762,18 @@ func clamp(v, low, high int) int { // Deprecated. -// Deprecated: use cursor.Mode. +// Deprecated: use [cursor.Mode]. +// +//nolint:revive type CursorMode int +//nolint:revive const ( - // Deprecated: use cursor.CursorBlink. + // Deprecated: use [cursor.CursorBlink]. CursorBlink = CursorMode(cursor.CursorBlink) - // Deprecated: use cursor.CursorStatic. + // Deprecated: use [cursor.CursorStatic]. CursorStatic = CursorMode(cursor.CursorStatic) - // Deprecated: use cursor.CursorHide. + // Deprecated: use [cursor.CursorHide]. CursorHide = CursorMode(cursor.CursorHide) ) @@ -776,12 +781,16 @@ func (c CursorMode) String() string { return cursor.Mode(c).String() } -// Deprecated: use cursor.Mode(). +// Deprecated: use [cursor.Mode]. +// +//nolint:revive func (m Model) CursorMode() CursorMode { return CursorMode(m.Cursor.Mode()) } // Deprecated: use cursor.SetMode(). +// +//nolint:revive func (m *Model) SetCursorMode(mode CursorMode) tea.Cmd { return m.Cursor.SetMode(cursor.Mode(mode)) } @@ -819,7 +828,7 @@ func (m *Model) MatchedSuggestions() []string { return m.getSuggestions(m.matchedSuggestions) } -// CurrentSuggestion returns the currently selected suggestion index. +// CurrentSuggestionIndex returns the currently selected suggestion index. func (m *Model) CurrentSuggestionIndex() int { return m.currentSuggestionIndex } diff --git a/viewport/keymap.go b/viewport/keymap.go index 060bb87..86eff98 100644 --- a/viewport/keymap.go +++ b/viewport/keymap.go @@ -1,3 +1,5 @@ +// Package viewport provides a component for rendering a viewport in a Bubble +// Tea. package viewport import "github.com/charmbracelet/bubbles/key" diff --git a/viewport/viewport.go b/viewport/viewport.go index b9bccdf..5862ac0 100644 --- a/viewport/viewport.go +++ b/viewport/viewport.go @@ -178,7 +178,7 @@ func (m *Model) SetYOffset(n int) { m.YOffset = clamp(n, 0, m.maxYOffset()) } -// PageDown moves the view down by the number of lines in the viewport. +// ViewDown moves the view down by the number of lines in the viewport. // Basically, "page down". // // Deprecated: use [Model.PageDown] instead.