Skip to content

Commit

Permalink
fix: lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Mar 8, 2024
1 parent 7b97817 commit 194455d
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 17 deletions.
7 changes: 5 additions & 2 deletions cmd/soft/browse/browse.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,11 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, tea.Quit
}
case tea.MouseMsg:
switch msg.Type {
case tea.MouseLeft:
if msg.Action != tea.MouseActionPress {
break
}
switch msg.Button {
case tea.MouseButtonLeft:
switch {
case m.common.Zone.Get("footer").InBounds(msg):
cmds = append(cmds, footer.ToggleFooterCmd)
Expand Down
8 changes: 4 additions & 4 deletions pkg/db/migrate/0003_migrate_lfs_objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ var migrateLfsObjects = Migration{
cfg := config.FromContext(ctx)
logger := log.FromContext(ctx).WithPrefix("migrate_lfs_objects")

var repoIds []int64
if err := tx.Select(&repoIds, "SELECT id FROM repos"); err != nil {
var repoIDs []int64
if err := tx.Select(&repoIDs, "SELECT id FROM repos"); err != nil {
return err
}
for _, r := range repoIds {
for _, r := range repoIDs {
var objs []models.LFSObject
if err := tx.Select(&objs, "SELECT * FROM lfs_objects WHERE repo_id = ?", r); err != nil {
return err
Expand All @@ -50,7 +50,7 @@ var migrateLfsObjects = Migration{
}
return nil
},
Rollback: func(ctx context.Context, tx *db.Tx) error {
Rollback: func(context.Context, *db.Tx) error {
return nil
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func NewSSHServer(ctx context.Context) (*SSHServer, error) {
}

if config.IsDebug() {
s.srv.ServerConfigCallback = func(ctx ssh.Context) *gossh.ServerConfig {
s.srv.ServerConfigCallback = func(_ ssh.Context) *gossh.ServerConfig {
return &gossh.ServerConfig{
AuthLogCallback: func(conn gossh.ConnMetadata, method string, err error) {
logger.Debug("authentication", "user", conn.User(), "method", method, "err", err)
Expand Down
7 changes: 5 additions & 2 deletions pkg/ssh/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,11 @@ func (ui *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
ui.showFooter = true
}
case tea.MouseMsg:
switch msg.Type {
case tea.MouseLeft:
if msg.Action != tea.MouseActionPress {
break
}
switch msg.Button {
case tea.MouseButtonLeft:
switch {
case ui.common.Zone.Get("footer").InBounds(msg):
cmds = append(cmds, footer.ToggleFooterCmd)
Expand Down
11 changes: 7 additions & 4 deletions pkg/ui/components/selector/selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,15 @@ func (s *Selector) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
cmds := make([]tea.Cmd, 0)
switch msg := msg.(type) {
case tea.MouseMsg:
switch msg.Type {
case tea.MouseWheelUp:
if msg.Action != tea.MouseActionPress {
break
}
switch msg.Button {
case tea.MouseButtonWheelUp:
s.CursorUp()
case tea.MouseWheelDown:
case tea.MouseButtonWheelDown:
s.CursorDown()
case tea.MouseLeft:
case tea.MouseButtonLeft:
curIdx := s.Index()
for i, item := range s.Items() {
item, _ := item.(IdentifiableItem)
Expand Down
6 changes: 5 additions & 1 deletion pkg/ui/components/tabs/tabs.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ func (t *Tabs) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
cmds = append(cmds, t.activeTabCmd)
}
case tea.MouseMsg:
if msg.Type == tea.MouseLeft {
if msg.Action != tea.MouseActionPress {
break
}
switch msg.Button {
case tea.MouseButtonLeft:
for i, tab := range t.tabs {
if t.common.Zone.Get(tab).InBounds(msg) {
t.activeTab = i
Expand Down
9 changes: 6 additions & 3 deletions pkg/ui/pages/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,16 @@ func (r *Repo) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
switch msg := msg.(type) {
case tea.MouseMsg:
switch msg.Type {
case tea.MouseLeft:
if msg.Action != tea.MouseActionPress {
break
}
switch msg.Button {
case tea.MouseButtonLeft:
switch {
case r.common.Zone.Get("repo-help").InBounds(msg):
cmds = append(cmds, footer.ToggleFooterCmd)
}
case tea.MouseRight:
case tea.MouseButtonRight:
switch {
case r.common.Zone.Get("repo-main").InBounds(msg):
cmds = append(cmds, goBackCmd)
Expand Down

0 comments on commit 194455d

Please sign in to comment.