Skip to content

Conversation

@glvr182
Copy link
Contributor

@glvr182 glvr182 commented Sep 10, 2018

format imports comments g passing error checking error logging
app_status_manager X X X X X X
branches_panel X X X X X X
commit_message_panel X X X X X X
commits_panel X X X X X X
confirmation_panel X X X X X X
files_panel X X X X X X
gui X X X X X X
keybindings X X X X X X
main_panel X X X X X X
menu_panel X X X X X X
merge_panel X X X X X X
stash_panel X X X X X X
status_panel X X X X X X
theme X X X X X X
updates X X X X X X
view_helpers X X X X X X

name string
statusType string
duration int
name string `json:"name"`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struct field name has json tag but is not exported

statusType string
duration int
name string `json:"name"`
statusType string `json:"status_type"`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struct field statusType has json tag but is not exported

duration int
name string `json:"name"`
statusType string `json:"status_type"`
duration int `json:"duration"`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struct field duration has json tag but is not exported

@codecov-io
Copy link

codecov-io commented Sep 10, 2018

Codecov Report

Merging #276 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #276      +/-   ##
==========================================
+ Coverage    92.4%   92.42%   +0.01%     
==========================================
  Files           9        9              
  Lines        1553     1557       +4     
==========================================
+ Hits         1435     1439       +4     
  Misses        117      117              
  Partials        1        1
Impacted Files Coverage Δ
pkg/utils/utils.go 55.1% <100%> (+3.99%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ca2eec6...fdb0f03. Read the comment docs.

for _, branch := range gui.State.Branches {
fmt.Fprintln(v, branch.GetDisplayString())
}
gui.resetOrigin(v)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.resetOrigin is not checked

gui.refreshStatus(g)
}
gui.refreshFiles(g)
gui.refreshFiles()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.refreshFiles is not checked

pkg/gui/gui.go Outdated
gui.Updater.CheckForNewUpdate(gui.onBackgroundUpdateCheckFinish, false)
gui.handleFileSelect(g, filesView)
gui.refreshFiles(g)
gui.refreshFiles()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.refreshFiles is not checked

pkg/gui/gui.go Outdated
go func() {
for range time.Tick(interval) {
function(g)
function()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of function is not checked

}
}

gui.refreshBranches(gui.g)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.refreshBranches is not checked


gui.refreshBranches(gui.g)
gui.refreshFiles()
gui.refreshCommits(gui.g)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.refreshCommits is not checked

} else {
gui.closeConfirmationPrompt(g)
gui.refreshCommits(g)
gui.refreshCommits()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.refreshCommits is not checked

gui.refreshStatus(g)
}
gui.refreshFiles(g)
gui.refreshFiles()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.refreshFiles is not checked

pkg/gui/gui.go Outdated
v.FgColor = gocui.ColorWhite
filesView.FgColor = gocui.ColorWhite

gui.registerRefresher("files", gui.refreshFiles)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.registerRefresher is not checked

pkg/gui/gui.go Outdated
v.Title = gui.Tr.SLocalize("CommitsTitle")
v.FgColor = gocui.ColorWhite

gui.registerRefresher("commits", gui.refreshCommits)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.registerRefresher is not checked

pkg/gui/gui.go Outdated
gui.refreshFiles(g)
gui.refreshBranches(g)
gui.refreshCommits(g)
gui.refreshFiles()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.refreshFiles is not checked

pkg/gui/gui.go Outdated
gui.refreshBranches(g)
gui.refreshCommits(g)
gui.refreshFiles()
gui.refreshBranches()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.refreshBranches is not checked

pkg/gui/gui.go Outdated
gui.refreshCommits(g)
gui.refreshFiles()
gui.refreshBranches()
gui.refreshCommits()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.refreshCommits is not checked


err := gui.GitCommand.Checkout(branch.Name, true)
if err != nil {
gui.createErrorPanel(g, err.Error())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.createErrorPanel is not checked

return gui.refreshSidePanels(g)
})

gui.createPromptPanel(g, v, gui.Tr.SLocalize("BranchName")+":",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.createPromptPanel is not checked


err := gui.GitCommand.Pull()
if err != nil {
gui.createErrorPanel(gui.g, err.Error())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.createErrorPanel is not checked

}
gui.stageSelectedFile(g)
gui.refreshFiles(g)
gui.refreshFiles()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.refreshFiles is not checked

pkg/gui/gui.go Outdated
gui.SubProcess.Stdin = os.Stdin
gui.SubProcess.Stdout = os.Stdout
gui.SubProcess.Stderr = os.Stderr
gui.SubProcess.Run()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.SubProcess.Run is not checked

Added a lot of if statements
Removed view specific render options functions since
we now have a global one.
Removed a lot of g passing
gui.createMessagePanel(g, v, "", gui.Tr.SLocalize("MergeAborted"))
gui.refreshStatus(g)
return gui.refreshFiles(g)
gui.refreshStatus()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of gui.refreshStatus is not checked

return err
}

err = gui.returnFocus(gui.g, view)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove gui.g from this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost done with view_handlers.go then this will be removed

@glvr182
Copy link
Contributor Author

glvr182 commented Sep 16, 2018

@jesseduffield It should all be good now

@andreimc andreimc self-requested a review September 17, 2018 01:48
Copy link
Contributor

@andreimc andreimc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few points if we want to get this merged in:

  • Too much whitespace around fns
  • Don't log on each error just bubble up errors and log at the top
  • naming is a bit hard to follow I can't understand what vv is in most cases
  • prefer if err := function(gui.g, v); err != nil { vs more verbose format

Good points:

  • gui.g is great vs passing g in functions
  • +1 on the docs

@glvr182
Copy link
Contributor Author

glvr182 commented Sep 17, 2018

Seem like fair points, could any of u @jesseduffield @andreimc help me out with changing some thing, kinda busy with work myself atm.

@jesseduffield
Copy link
Owner

Sure I'll jump onto this tomorrow :)

// In case something goes wrong it returns an error
func (gui *Gui) handleBranchPress(g *gocui.Gui, v *gocui.View) error {
v, err := gui.g.View("branches")
branchesView, err := gui.g.View("branches")
Copy link
Contributor Author

@glvr182 glvr182 Sep 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think v should be used here instead since it will always be the branches view

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm am I right in thinking we can just use the v that gets passed in?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, since the menu special case got solved, this v will always be branches

@jesseduffield
Copy link
Owner

I pushed a commit that has aligned a few panels (files panel, branches panel, commits panel, and a couple others iirc) with the structure I'm looking for

@jesseduffield
Copy link
Owner

also I've noticed that the application is slow to quit on this branch. I'm not sure what might be causing that

@glvr182
Copy link
Contributor Author

glvr182 commented Sep 18, 2018

I dont seem to have that problem, how bad is it

@jesseduffield
Copy link
Owner

about 2 seconds of latency

@glvr182
Copy link
Contributor Author

glvr182 commented Dec 9, 2018

Going to break this up into smaller pr's

@glvr182 glvr182 closed this Dec 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants