• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gabyx / Githooks / 6711

20 Feb 2026 05:55PM UTC coverage: 78.823% (-0.2%) from 78.997%
6711

push

circleci

web-flow
chore: linting improvements (#184)

This change request performs comprehensive linting cleanup across the Githooks codebase, modernizing code style and fixing various linting issues. The changes standardize code patterns, improve error handling, and introduce a centralized linting configuration.

**Changes:**
- Added `run_docker` wrapper function to handle Docker commands with/without sudo based on CI environment + `podman`.
- Modernized Go code: replaced `interface{}` with `any`, improved defer patterns, standardized error handling, and cleaned up return statements
- Fixed spelling errors in comments and documentation.
- Added centralized `.golangci.yaml` configuration file and updated the pre-commit hook to use it.
- Run formatting over `treefmt` in the Nix shell.

282 of 426 new or added lines in 67 files covered. (66.2%)

29 existing lines in 20 files now uncovered.

9350 of 11862 relevant lines covered (78.82%)

1745.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

59.26
/githooks/common/error-handler.go
1
package common
2

3
import (
4
        "os"
5
        "strings"
6
)
7

8
// HandleCLIErrors generally handles errors for the Githooks executables. Argument `cwd` can be empty.
9
func HandleCLIErrors(
10
        err any,
11
        log ILogContext,
12
        getBugReportingInfo func() string,
13
) bool {
3,104✔
14
        if err == nil {
6,072✔
15
                return false
2,968✔
16
        }
2,968✔
17

18
        var message []string
136✔
19
        withTrace := false
136✔
20

136✔
21
        switch v := err.(type) {
136✔
22
        case GithooksFailure:
136✔
23
                message = append(message, "Fatal error -> Abort.")
136✔
24
        case error:
×
25
                message = append(message, v.Error(), getBugReportingInfo())
×
26
                withTrace = true
×
27

28
        default:
×
29
                message = append(message, "Panic 💩: Unknown error.", getBugReportingInfo())
×
30
                withTrace = true
×
31
        }
32

33
        if log != nil {
272✔
34
                if withTrace {
136✔
35
                        log.ErrorWithStacktrace(message...)
×
36
                } else {
136✔
37
                        log.Error(message...)
136✔
38
                }
136✔
39
        } else {
×
NEW
40
                _, _ = os.Stderr.WriteString(strings.Join(message, "\n"))
×
NEW
41
                _, _ = os.Stderr.WriteString("\n")
×
UNCOV
42
        }
×
43

44
        return true
136✔
45
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc