debug linters

This commit is contained in:
Lifailon
2025-02-04 14:15:18 +03:00
parent 990652747d
commit 52e2f73668
2 changed files with 39 additions and 38 deletions
+33 -34
View File
@@ -8,41 +8,40 @@ linters:
# - ineffassign
# - staticcheck
# - unused
# - gocritic
# - err113
# - unparam
# - gocritic # https://github.com/go-critic/go-critic
# - misspell # errors in English words
enable-all: true
disable:
- dupl
- gocognit
- goconst
- gosec
- revive
- cyclop
- depguard
- forbidigo
- funlen
- godot
- gofumpt
- lll
- makezero
- misspell
- mnd
- nestif
- nilerr
- nlreturn
- tagliatelle
- varnamelen
- wrapcheck
- wsl
- gocyclo
- unconvert
- errorlint
- ireturn
- maintidx
- nonamedreturns
- stylecheck
- exhaustruct
- exportloopref
- copyloopvar
- intrange
- gosec # https://github.com/securego/gosec
- makezero # make([]byte, readSize) => make([]byte, 0, readSize)
- dupl # code clone detection
- wsl # force use empty lines
- goconst # string has 7 occurrences, make it a constant
- gocognit # cognitive complexity 80 of func is high (> 30)
- gocyclo # cyclomatic complexity 61 of func is high (> 30)
- revive # cognitive complexity 73 of func (> 30)
- maintidx # function loadServices, Cyclomatic Complexity: 27, Halstead Volume: 6660.60, Maintainability Index: 18
- cyclop # calculated cyclomatic complexity for function loadServices is 28, max is 10
- depguard # import 'github.com/awesome-gocui/gocui' is not allowed from list 'Main'
- forbidigo # use of `fmt.Printf` forbidden by pattern
- funlen # function is too long (70 > 60)
- godot # comment should end in a period
- gofumpt # file is not properly formatted for regex
- lll # line is 121 characters long, which exceeds the maximum of 120 characters
- mnd # magic number in <argument> detected
- nestif # 'if err != nil' has complex nested blocks (complexity: 8)
- nilerr # error is not nil but it returns nil
- nlreturn # break with no blank line before
- tagliatelle # json
- varnamelen # variable name 'i' is too short for the scope of its usage
- wrapcheck # error returned from external package is unwrapped
- ireturn # function createFilterEditor returns interface (github.com/awesome-gocui/gocui.Editor)
- nonamedreturns # named return "output" with type "[]byte" found
- stylecheck # ST1003/ST1023
- exhaustruct # app is missing fields gui, getOS, getArch, hostName, userName...
- unconvert # unnecessary conversion
- copyloopvar # Go 1.22 +
- intrange # Go 1.22+
- exportloopref # Lintern is obsolete
+6 -4
View File
@@ -924,7 +924,7 @@ func (app *App) loadJournalLogs(serviceName string, newUpdate bool, g *gocui.Gui
}
}
output = app.loadWinEventLog(eventName)
if len(string(output)) == 0 || string(output) == "" {
if len(output) == 0 {
v, _ := app.gui.View("logs")
v.Clear()
return
@@ -2582,7 +2582,7 @@ func (app *App) wordColor(inputWord string) string {
}
}
case strings.Contains(inputWordLower, "stop"):
words := []string{"stopping", "stopped", "stops", "stop"}
words := []string{"stopping", "stopped", "stoped", "stops", "stop"}
for _, word := range words {
if strings.Contains(inputWordLower, word) {
coloredWord = app.replaceWordLower(inputWord, word, "\033[31m")
@@ -2722,7 +2722,7 @@ func (app *App) wordColor(inputWord string) string {
coloredWord = app.replaceWordLower(inputWord, "null", "\033[31m")
// Зеленый (успех) [32m]
case strings.Contains(inputWordLower, "succe"):
words := []string{"successfully", "successfull", "successful", "succeeded", "succeed", "success"}
words := []string{"successfully", "successful", "succeeded", "succeed", "success"}
for _, word := range words {
if strings.Contains(inputWordLower, word) {
coloredWord = app.replaceWordLower(inputWord, word, "\033[32m")
@@ -2730,7 +2730,7 @@ func (app *App) wordColor(inputWord string) string {
}
}
case strings.Contains(inputWordLower, "complet"):
words := []string{"completed", "completing", "completion", "complets", "complete"}
words := []string{"completed", "completing", "completion", "completes", "complete"}
for _, word := range words {
if strings.Contains(inputWordLower, word) {
coloredWord = app.replaceWordLower(inputWord, word, "\033[32m")
@@ -3102,6 +3102,8 @@ func (app *App) wordColor(inputWord string) string {
}
case strings.Contains(inputWordLower, "debug"):
coloredWord = app.replaceWordLower(inputWord, "debug", "\033[36m")
case strings.Contains(inputWordLower, "verbose"):
coloredWord = app.replaceWordLower(inputWord, "verbose", "\033[36m")
case strings.HasPrefix(inputWordLower, "trace"):
coloredWord = app.replaceWordLower(inputWord, "trace", "\033[36m")
case strings.HasPrefix(inputWordLower, "protocol"):