padok-team / burrito

🌯 Burrito is a TACoS Kubernetes Operator - "ArgoCD for Terraform"
https://padok-team.github.io/burrito
Apache License 2.0
252 stars 10 forks source link

fix(lints): fix code smell detected by golangci-lint #158

Closed corrieriluca closed 1 year ago

corrieriluca commented 1 year ago

From the code smells detected by golangci-lint.

See PR #157 for CI/CD integration.

If fixes the following lint warnings:

internal/burrito/config/config.go:126:14: Error return value of `v.BindPFlags` is not checked (errcheck)
        v.BindPFlags(flags)
                    ^
internal/burrito/config/config.go:154:13: Error return value of `v.BindEnv` is not checked (errcheck)
                        v.BindEnv(strings.Join(append(parts, tv), "."))
                                 ^
internal/controllers/terraformpullrequest/comment/default.go:69:25: Error return value of `defaultTemplate.Execute` is not checked (errcheck)
        defaultTemplate.Execute(comment, data)
                               ^
internal/testing/loading.go:40:18: Error return value of `filepath.WalkDir` is not checked (errcheck)
        filepath.WalkDir(path, func(path string, d fs.DirEntry, err error) error {
                        ^
internal/testing/loading.go:47:3: SA4009(related information): assignment to err (staticcheck)
                data, err := os.ReadFile(path)
                ^
internal/webhook/github/provider_test.go:10:2: SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details. (staticcheck)
        "io/ioutil"
        ^
internal/webhook/gitlab/provider_test.go:6:2: SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details. (staticcheck)
        "io/ioutil"
        ^
internal/controllers/terraformpullrequest/github/provider.go:24:5: SA4022: the address of a variable cannot be nil (staticcheck)
        if &c.Controller.GithubConfig == nil {
           ^
internal/controllers/terraformpullrequest/gitlab/provider.go:21:5: SA4022: the address of a variable cannot be nil (staticcheck)
        if &c.Controller.GitlabConfig == nil {
           ^
codecov-commenter commented 1 year ago

Codecov Report

Merging #158 (976b0ab) into main (a45d91b) will decrease coverage by 0.81%. The diff coverage is 25.00%.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main     #158      +/-   ##
==========================================
- Coverage   69.84%   69.04%   -0.81%     
==========================================
  Files          23       23              
  Lines        1572     1586      +14     
==========================================
- Hits         1098     1095       -3     
- Misses        412      425      +13     
- Partials       62       66       +4     
Files Changed Coverage Δ
...ontrollers/terraformpullrequest/comment/default.go 0.00% <0.00%> (ø)
internal/burrito/config/config.go 49.36% <30.00%> (-12.40%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more