mirror of
https://github.com/makeworld-the-better-one/amfora.git
synced 2024-09-11 22:57:37 +03:00
🚨 Fix linting errors and switch to disable-all model
Lint errors source: https://github.com/makeworld-the-better-one/amfora/actions/runs/224352889
This commit is contained in:
parent
f5e45a70ed
commit
de41930d0a
3
.github/workflows/golangci-lint.yml
vendored
3
.github/workflows/golangci-lint.yml
vendored
@ -13,7 +13,6 @@ jobs:
|
||||
version: v1.30
|
||||
|
||||
# Optional: golangci-lint command line arguments.
|
||||
args: --exclude-use-default --enable-all -D asciicheck -D depguard -D dogsled -D funlen -D gci -D gochecknoglobals -D gochecknoinits -D gocognit -D gocyclo -D godot -D godox -D goheader -D gomodguard -D nlreturn -D noctx -D bodyclose -D rowserrcheck -D sqlclosecheck -D stylecheck -D testpackage -D wsl
|
||||
|
||||
args: --exclude-use-default --disable-all -E deadcode -E errcheck -E gosimple -E govet -E ineffassign -E staticcheck -E structcheck -E typecheck -E unused -E varcheck -E dupl -E exhaustive -E exportloopref -E goconst -E gocritic -E goerr113 -E gofmt -E gofumpt -E goimports -E golint -E gomnd -E goprintffuncname -E gosec -E interfacer -E lll -E maligned -E misspell -E nakedret -E nestif -E nolintlint -E prealloc -E scopelint -E unconvert -E unparam -E whitespace
|
||||
# Optional: show only new issues if it's a pull request. The default value is `false`.
|
||||
only-new-issues: true
|
||||
|
@ -19,7 +19,7 @@ func bkmkKey(url string) string {
|
||||
|
||||
func Set(url, name string) {
|
||||
bkmkStore.Set(bkmkKey(url), name)
|
||||
bkmkStore.WriteConfig()
|
||||
bkmkStore.WriteConfig() //nolint:errcheck
|
||||
}
|
||||
|
||||
// Get returns the NAME of the bookmark, given the URL.
|
||||
@ -33,7 +33,7 @@ func Remove(url string) {
|
||||
// XXX: Viper can't actually delete keys, which means the bookmarks file might get clouded
|
||||
// with non-entries over time.
|
||||
bkmkStore.Set(bkmkKey(url), "")
|
||||
bkmkStore.WriteConfig()
|
||||
bkmkStore.WriteConfig() //nolint:errcheck
|
||||
}
|
||||
|
||||
// All returns all the bookmarks in a map of URLs to names.
|
||||
@ -49,8 +49,8 @@ func All() (map[string]string, []string) {
|
||||
}
|
||||
|
||||
inverted := make(map[string]string) // Holds inverted map, name->URL
|
||||
var names []string // Holds bookmark names, for sorting
|
||||
var keys []string // Final sorted keys (URLs), for returning at the end
|
||||
names := make([]string, 0, len(bkmksMap)) // Holds bookmark names, for sorting
|
||||
keys := make([]string, 0, len(bkmksMap)) // Final sorted keys (URLs), for returning at the end
|
||||
|
||||
for b32Url, name := range bkmksMap {
|
||||
if n, ok := name.(string); n == "" || !ok {
|
||||
|
@ -529,7 +529,7 @@ func Reload() {
|
||||
func URL(u string) {
|
||||
// Some code is copied in followLink()
|
||||
|
||||
if u == "about:bookmarks" {
|
||||
if u == "about:bookmarks" { //nolint:goconst
|
||||
Bookmarks(tabs[curTab])
|
||||
tabs[curTab].addToHistory("about:bookmarks")
|
||||
return
|
||||
|
@ -142,7 +142,7 @@ func downloadURL(u string, resp *gemini.Response) {
|
||||
progressbar.OptionShowCount(),
|
||||
progressbar.OptionSpinnerType(14),
|
||||
)
|
||||
bar.RenderBlank()
|
||||
bar.RenderBlank() //nolint:errcheck
|
||||
|
||||
savePath, err := downloadNameFromURL(u, "")
|
||||
if err != nil {
|
||||
|
@ -70,15 +70,18 @@ func reformatPage(p *structs.Page) {
|
||||
return
|
||||
}
|
||||
|
||||
// TODO: Setup a renderer.RenderFromMediatype func so this isn't needed
|
||||
|
||||
var rendered string
|
||||
if p.Mediatype == structs.TextGemini {
|
||||
switch p.Mediatype {
|
||||
case structs.TextGemini:
|
||||
// Links are not recorded because they won't change
|
||||
rendered, _ = renderer.RenderGemini(p.Raw, textWidth(), leftMargin())
|
||||
} else if p.Mediatype == structs.TextPlain {
|
||||
case structs.TextPlain:
|
||||
rendered = renderer.RenderPlainText(p.Raw, leftMargin())
|
||||
} else if p.Mediatype == structs.TextAnsi {
|
||||
case structs.TextAnsi:
|
||||
rendered = renderer.RenderANSI(p.Raw, leftMargin())
|
||||
} else {
|
||||
default:
|
||||
// Rendering this type is not implemented
|
||||
return
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ func makeNewTab() *tab {
|
||||
return
|
||||
}
|
||||
|
||||
if len(tabs[tab].page.Links) <= 0 {
|
||||
if len(tabs[tab].page.Links) == 0 {
|
||||
// No links on page
|
||||
return
|
||||
}
|
||||
@ -85,7 +85,7 @@ func makeNewTab() *tab {
|
||||
followLink(tabs[tab], tabs[tab].page.Url, tabs[tab].page.Links[linkN])
|
||||
return
|
||||
}
|
||||
if len(currentSelection) <= 0 && (key == tcell.KeyEnter || key == tcell.KeyTab) {
|
||||
if len(currentSelection) == 0 && (key == tcell.KeyEnter || key == tcell.KeyTab) {
|
||||
// They've started link highlighting
|
||||
tabs[tab].page.Mode = structs.ModeLinkSelect
|
||||
|
||||
@ -102,7 +102,7 @@ func makeNewTab() *tab {
|
||||
// There's still a selection, but a different key was pressed, not Enter
|
||||
|
||||
index, _ := strconv.Atoi(currentSelection[0])
|
||||
if key == tcell.KeyTab {
|
||||
if key == tcell.KeyTab { //nolint:gocritic
|
||||
index = (index + 1) % numSelections
|
||||
} else if key == tcell.KeyBacktab {
|
||||
index = (index - 1 + numSelections) % numSelections
|
||||
|
Loading…
Reference in New Issue
Block a user