From c235780eee48776d7a9309e0a46b6c474f893ef3 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Mon, 30 Nov 2020 22:12:05 -0500 Subject: [PATCH] Appease the linter --- github.go | 4 ++-- gitlab.go | 4 ++-- ui/doctypes.go | 2 +- ui/pager.go | 2 +- ui/stash.go | 13 +++++-------- ui/stashitem.go | 3 --- ui/ui.go | 2 +- 7 files changed, 12 insertions(+), 18 deletions(-) diff --git a/github.go b/github.go index 3b944cc..7cf29bc 100644 --- a/github.go +++ b/github.go @@ -7,7 +7,7 @@ import ( "strings" ) -// isGitHubURL tests a string to determine if it is a well-structured GitHub URL +// isGitHubURL tests a string to determine if it is a well-structured GitHub URL. func isGitHubURL(s string) (string, bool) { if strings.HasPrefix(s, "github.com/") { s = "https://" + s @@ -21,7 +21,7 @@ func isGitHubURL(s string) (string, bool) { return u.String(), strings.ToLower(u.Host) == "github.com" } -// findGitHubREADME tries to find the correct README filename in a repository +// findGitHubREADME tries to find the correct README filename in a repository. func findGitHubREADME(s string) (*source, error) { u, err := url.ParseRequestURI(s) if err != nil { diff --git a/gitlab.go b/gitlab.go index 7bebc93..5ec89c7 100644 --- a/gitlab.go +++ b/gitlab.go @@ -7,7 +7,7 @@ import ( "strings" ) -// isGitLabURL tests a string to determine if it is a well-structured GitLab URL +// isGitLabURL tests a string to determine if it is a well-structured GitLab URL. func isGitLabURL(s string) (string, bool) { if strings.HasPrefix(s, "gitlab.com/") { s = "https://" + s @@ -21,7 +21,7 @@ func isGitLabURL(s string) (string, bool) { return u.String(), strings.ToLower(u.Host) == "gitlab.com" } -// findGitLabREADME tries to find the correct README filename in a repository +// findGitLabREADME tries to find the correct README filename in a repository. func findGitLabREADME(s string) (*source, error) { u, err := url.ParseRequestURI(s) if err != nil { diff --git a/ui/doctypes.go b/ui/doctypes.go index 630ace4..a7dfb0b 100644 --- a/ui/doctypes.go +++ b/ui/doctypes.go @@ -31,7 +31,7 @@ func (d *DocTypeSet) Add(t ...DocType) int { return len(*d) } -// Had returns whether or not the set contains the given DocTypes. +// Contains returns whether or not the set contains the given DocTypes. func (d DocTypeSet) Contains(m ...DocType) bool { matches := 0 for _, t := range m { diff --git a/ui/pager.go b/ui/pager.go index 33ea846..6eaa041 100644 --- a/ui/pager.go +++ b/ui/pager.go @@ -35,7 +35,7 @@ var ( statusBarNoteFg = common.NewColorPair("#7D7D7D", "#656565") statusBarBg = common.NewColorPair("#242424", "#E6E6E6") - // Styling funcs + // Styling funcs. statusBarScrollPosStyle = newStyle(common.NewColorPair("#5A5A5A", "#949494"), statusBarBg, false) statusBarNoteStyle = newStyle(statusBarNoteFg, statusBarBg, false) statusBarHelpStyle = newStyle(statusBarNoteFg, common.NewColorPair("#323232", "#DCDCDC"), false) diff --git a/ui/stash.go b/ui/stash.go index 91c028d..d464b22 100644 --- a/ui/stash.go +++ b/ui/stash.go @@ -237,7 +237,7 @@ func (m *stashModel) addMarkdowns(mds ...*markdown) { } } -// Find a local markdown by its path and replace it +// Find a local markdown by its path and replace it. func (m *stashModel) replaceLocalMarkdown(localPath string, newMarkdown *markdown) error { var found bool @@ -576,7 +576,7 @@ func (m stashModel) update(msg tea.Msg) (stashModel, tea.Cmd) { return m, tea.Batch(cmds...) } -// Updates for when a user is browsing the markdown listing +// Updates for when a user is browsing the markdown listing. func (m *stashModel) handleDocumentBrowsing(msg tea.Msg) tea.Cmd { var cmds []tea.Cmd @@ -780,7 +780,6 @@ func (m *stashModel) handleDocumentBrowsing(msg tea.Msg) tea.Cmd { func (m *stashModel) handleDeleteConfirmation(msg tea.Msg) tea.Cmd { if msg, ok := msg.(tea.KeyMsg); ok { switch msg.String() { - // Confirm deletion case "y": if m.selectionState != selectionPromptingDelete { @@ -818,14 +817,13 @@ func (m *stashModel) handleDeleteConfirmation(msg tea.Msg) tea.Cmd { default: // Any other keys cancels deletion m.selectionState = selectionIdle - } } return nil } -// Updates for when a user is in the filter editing interface +// Updates for when a user is in the filter editing interface. func (m *stashModel) handleFiltering(msg tea.Msg) tea.Cmd { var cmds []tea.Cmd @@ -1032,9 +1030,8 @@ func (m stashModel) headerView() string { if loading && noMarkdowns { if m.stashedOnly() { return common.Subtle("Loading your stash...") - } else { - return common.Subtle("Looking for stuff...") + maybeOffline } + return common.Subtle("Looking for stuff...") + maybeOffline } localItems := m.countMarkdowns(LocalDoc) @@ -1491,7 +1488,7 @@ func filterMarkdowns(m stashModel) tea.Cmd { // ETC -// Delete a markdown from a slice of markdowns +// Delete a markdown from a slice of markdowns. func deleteMarkdown(markdowns []*markdown, target *markdown) ([]*markdown, error) { index := -1 diff --git a/ui/stashitem.go b/ui/stashitem.go index 2f9894b..8bfbea8 100644 --- a/ui/stashitem.go +++ b/ui/stashitem.go @@ -100,9 +100,7 @@ func stashItemView(b *strings.Builder, m stashModel, index int, md *markdown) { } gutter = " " date = dimBrightGrayFg(date) - } else { - icon = greenFg(icon) if title == noMemoTitle { title = brightGrayFg(title) @@ -113,7 +111,6 @@ func stashItemView(b *strings.Builder, m stashModel, index int, md *markdown) { gutter = " " date = brightGrayFg(date) } - } fmt.Fprintf(b, "%s %s%s\n", gutter, icon, title) diff --git a/ui/ui.go b/ui/ui.go index f325f46..e8d74f9 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -135,7 +135,7 @@ const ( keygenFinished ) -// General stuff we'll need to access in all models +// General stuff we'll need to access in all models. type general struct { cfg Config cc *charm.Client