Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Aug 18, 2023
Merged

Conversation

corrieriluca
Copy link
Member

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 {
           ^

@corrieriluca corrieriluca changed the title fix(lints): fix code smell suggested from CI fix(lints): fix code smell detected by golangci-lint Aug 4, 2023
@codecov-commenter
Copy link

Codecov Report

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

❗ 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%) ⬇️

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

@Alan-pad Alan-pad merged commit c0abbca into main Aug 18, 2023
@corrieriluca corrieriluca deleted the fix/lints branch September 20, 2023 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants