Skip to content

Commit

Permalink
Make staticcheck checks more agressive
Browse files Browse the repository at this point in the history
Poorly choosen indentifiers, consistent receiver names in struct methods, and exported APIs should have comments beginning with type name.
  • Loading branch information
Jacalz committed Jan 7, 2024
1 parent b49d90c commit ea6e92e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions dialog/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,21 +653,21 @@ func TestCreateNewFolderInDir(t *testing.T) {
defer win.Canvas().Overlays().Remove(inputPopup)
assert.NotNil(t, inputPopup)

folderNameInputUi := inputPopup.Content.(*fyne.Container)
folderNameInputUI := inputPopup.Content.(*fyne.Container)

folderNameInputTitle := folderNameInputUi.Objects[4].(*widget.Label)
folderNameInputTitle := folderNameInputUI.Objects[4].(*widget.Label)
assert.Equal(t, "New Folder", folderNameInputTitle.Text)

folderNameInputLabel := folderNameInputUi.Objects[2].(*widget.Form).Items[0].Text
folderNameInputLabel := folderNameInputUI.Objects[2].(*widget.Form).Items[0].Text
assert.Equal(t, "Name", folderNameInputLabel)

folderNameInputEntry := folderNameInputUi.Objects[2].(*widget.Form).Items[0].Widget.(*widget.Entry)
folderNameInputEntry := folderNameInputUI.Objects[2].(*widget.Form).Items[0].Widget.(*widget.Entry)
assert.Equal(t, "", folderNameInputEntry.Text)

folderNameInputCancel := folderNameInputUi.Objects[3].(*fyne.Container).Objects[0].(*widget.Button)
folderNameInputCancel := folderNameInputUI.Objects[3].(*fyne.Container).Objects[0].(*widget.Button)
assert.Equal(t, "Cancel", folderNameInputCancel.Text)
assert.Equal(t, theme.CancelIcon(), folderNameInputCancel.Icon)

folderNameInputCreate := folderNameInputUi.Objects[3].(*fyne.Container).Objects[1].(*widget.Button)
folderNameInputCreate := folderNameInputUI.Objects[3].(*fyne.Container).Objects[1].(*widget.Button)
assert.Equal(t, theme.ConfirmIcon(), folderNameInputCreate.Icon)
}
6 changes: 3 additions & 3 deletions internal/async/chan_go1.21.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "fyne.io/fyne/v2"
// Func objects. A channel must be closed via Close method
type UnboundedFuncChan = UnboundedChan[func()]

// NewUnboundedInterfaceChan returns a unbounded channel, of func(), with unlimited capacity.
// NewUnboundedFuncChan returns a unbounded channel, of func(), with unlimited capacity.
func NewUnboundedFuncChan() *UnboundedFuncChan {
return NewUnboundedChan[func()]()
}
Expand All @@ -31,15 +31,15 @@ func NewUnboundedCanvasObjectChan() *UnboundedChan[fyne.CanvasObject] {
return NewUnboundedChan[fyne.CanvasObject]()
}

// UnboundedFuncChan is a channel with an unbounded buffer for caching
// UnboundedChan is a channel with an unbounded buffer for caching
// Func objects. A channel must be closed via Close method.
type UnboundedChan[T any] struct {
in, out chan T
close chan struct{}
q []T
}

// NewUnboundedFuncChan returns a unbounded channel with unlimited capacity.
// NewUnboundedChan returns a unbounded channel with unlimited capacity.
func NewUnboundedChan[T any]() *UnboundedChan[T] {
ch := &UnboundedChan[T]{
// The size of Func, Interface, and CanvasObject are all less than 16 bytes, we use 16 to fit
Expand Down
2 changes: 1 addition & 1 deletion staticcheck.conf
Original file line number Diff line number Diff line change
@@ -1 +1 @@
checks = ["inherit", "-SA1019"]
checks = ["inherit", "-SA1019", "ST1003", "ST1016", "ST1020", "ST1021", "ST1022"]
2 changes: 1 addition & 1 deletion widget/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ func (e *Entry) SetText(text string) {
e.propertyLock.Unlock()
}

// Appends the text to the end of the entry
// Append appends the text to the end of the entry.
//
// Since: 2.4
func (e *Entry) Append(text string) {
Expand Down
2 changes: 1 addition & 1 deletion widget/slider.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (s *Slider) DragEnd() {
}
}

// DragEnd is called when a drag event occurs.
// Dragged is called when a drag event occurs.
func (s *Slider) Dragged(e *fyne.DragEvent) {
if s.disabled {
return
Expand Down

0 comments on commit ea6e92e

Please sign in to comment.