Skip to content

Commit

Permalink
disable revive: fix part of lll's and stylechecks
Browse files Browse the repository at this point in the history
  • Loading branch information
gucio321 committed Sep 19, 2021
1 parent a7ce405 commit abc9712
Show file tree
Hide file tree
Showing 8 changed files with 229 additions and 109 deletions.
4 changes: 1 addition & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,12 @@ linters:
- makezero
- misspell
- nakedret
- nestif
- nilerr
#- nlreturn
- nolintlint
- prealloc
- predeclared
- promlinter
- revive
#- revive
- rowserrcheck
- staticcheck
- structcheck
Expand Down
2 changes: 1 addition & 1 deletion CodeEditor.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func CodeEditor(title string) *CodeEditorWidget {
}
}

// ShowWhitespace sets if whitespaces are shown in code editor
// ShowWhitespaces sets if whitespaces are shown in code editor
func (ce *CodeEditorWidget) ShowWhitespaces(s bool) *CodeEditorWidget {
ce.getState().editor.SetShowWhitespaces(s)
return ce
Expand Down
2 changes: 1 addition & 1 deletion EventHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (eh *EventHandler) OnKeyPressed(key Key, cb func()) *EventHandler {
return eh
}

// OnKeyReleaed sets callback when key `key` is released
// OnKeyReleased sets callback when key `key` is released
func (eh *EventHandler) OnKeyReleased(key Key, cb func()) *EventHandler {
eh.keyEvents = append(eh.keyEvents, keyEvent{key, cb, IsKeyReleased})
return eh
Expand Down
298 changes: 204 additions & 94 deletions Flags.go

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion Plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,13 @@ func (p *PlotCanvasWidget) Build() {
imgui.ImPlotSetNextPlotTicksY(p.yTicksValue, p.yTicksLabel, p.yTicksShowDefault, int(p.yTicksYAxis))
}

if imgui.ImPlotBegin(tStr(p.title), tStr(p.xLabel), tStr(p.yLabel), ToVec2(image.Pt(p.width, p.height)), imgui.ImPlotFlags(p.flags), imgui.ImPlotAxisFlags(p.xFlags), imgui.ImPlotAxisFlags(p.yFlags), imgui.ImPlotAxisFlags(p.y2Flags), imgui.ImPlotAxisFlags(p.y3Flags), tStr(p.y2Label), tStr(p.y3Label)) {
if imgui.ImPlotBegin(
tStr(p.title), tStr(p.xLabel),
tStr(p.yLabel), ToVec2(image.Pt(p.width, p.height)),
imgui.ImPlotFlags(p.flags), imgui.ImPlotAxisFlags(p.xFlags),
imgui.ImPlotAxisFlags(p.yFlags), imgui.ImPlotAxisFlags(p.y2Flags),
imgui.ImPlotAxisFlags(p.y3Flags), tStr(p.y2Label), tStr(p.y3Label),
) {
for _, plot := range p.plots {
plot.Plot()
}
Expand Down
10 changes: 8 additions & 2 deletions Utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func ToVec2(pt image.Point) imgui.Vec2 {
}
}

// Vec4ToRgba converts imgui's Vec4 to golang rgba color
// Vec4ToRGBA converts imgui's Vec4 to golang rgba color
func Vec4ToRGBA(vec4 imgui.Vec4) color.RGBA {
return color.RGBA{
R: uint8(vec4.X * 255),
Expand Down Expand Up @@ -145,7 +145,13 @@ func SetNextWindowPos(x, y float32) {

// SetNextWindowSizeV does similar to SetNextWIndowSize but allows to specify imgui.Condition
func SetNextWindowSizeV(width, height float32, condition ExecCondition) {
imgui.SetNextWindowSizeV(imgui.Vec2{X: width * Context.platform.GetContentScale(), Y: height * Context.platform.GetContentScale()}, imgui.Condition(condition))
imgui.SetNextWindowSizeV(
imgui.Vec2{
X: width * Context.platform.GetContentScale(),
Y: height * Context.platform.GetContentScale(),
},
imgui.Condition(condition),
)
}

// SetItemDefaultFocus set the item focused by default
Expand Down
12 changes: 6 additions & 6 deletions Widgets.go
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ func ImageWithURL(url string) *ImageWithURLWidget {
}
}

// Event trigger when image is downloaded and ready to display.
// OnReady sets event trigger when image is downloaded and ready to display.
func (i *ImageWithURLWidget) OnReady(onReady func()) *ImageWithURLWidget {
i.onReady = onReady
return i
Expand Down Expand Up @@ -1132,7 +1132,7 @@ func (i *InputTextWidget) Labelf(format string, args ...interface{}) *InputTextW
return i.Label(fmt.Sprintf(format, args...))
}

// Enable auto complete popup by using fuzzy search of current value against candidates
// AutoComplete enables auto complete popup by using fuzzy search of current value against candidates
// Press enter to confirm the first candidate
func (i *InputTextWidget) AutoComplete(candidates []string) *InputTextWidget {
i.candidates = candidates
Expand Down Expand Up @@ -1684,7 +1684,7 @@ func (s *SelectableWidget) OnClick(onClick func()) *SelectableWidget {
return s
}

// Handle mouse left button's double click event.
// OnDClick handles mouse left button's double click event.
// SelectableFlagsAllowDoubleClick will set once tonDClick callback is notnull
func (s *SelectableWidget) OnDClick(onDClick func()) *SelectableWidget {
s.onDClick = onDClick
Expand Down Expand Up @@ -2298,7 +2298,7 @@ func Table() *TableWidget {
}
}

// Display visible rows only to boost performance.
// FastMode Displays visible rows only to boost performance.
func (t *TableWidget) FastMode(b bool) *TableWidget {
t.fastMode = b
return t
Expand Down Expand Up @@ -2581,7 +2581,7 @@ func (t *TreeNodeWidget) Flags(flags TreeNodeFlags) *TreeNodeWidget {
return t
}

// Create TreeNode with eventHandler
// Event create TreeNode with eventHandler
// You could detect events (e.g. IsItemClicked IsMouseDoubleClicked etc...) and handle them for TreeNode inside eventHandler
func (t *TreeNodeWidget) Event(handler func()) *TreeNodeWidget {
t.eventHandler = handler
Expand Down Expand Up @@ -2670,7 +2670,7 @@ func (c *ConditionWidget) Build() {
}
}

// Batch create widgets and render only which is visible.
// RangeBuilder batch create widgets and render only which is visible.
func RangeBuilder(id string, values []interface{}, builder func(int, interface{}) Widget) Layout {
var layout Layout

Expand Down
2 changes: 1 addition & 1 deletion Window.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (w *WindowWidget) HasFocus() bool {
return w.getState().hasFocus
}

// Registerkeyboardshortcuts adds local (window-level) keyboard shortcuts
// RegisterKeyboardShortcuts adds local (window-level) keyboard shortcuts
// see InputHandler.go
func (w *WindowWidget) RegisterKeyboardShortcuts(s ...WindowShortcut) *WindowWidget {
if w.HasFocus() {
Expand Down

0 comments on commit abc9712

Please sign in to comment.