Skip to content
New issue

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

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

Already on GitHub? # to your account

refactor: Enable revive and fix up lint issues #3345

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

alexandear
Copy link
Contributor

@alexandear alexandear commented Nov 11, 2024

This PR enables revive in the .golangci.yml config and fixes appeared revive lint issues.

The PR updates golangci-lint's version because revive.filename-format was introduced in the v1.62.0.

Details

❯ golangci-lint run
github/event_types_test.go:59:2: unexported-naming: the symbol Base is local, its name should start with a lowercase letter (revive)
        Base := EditBase{
        ^
github/repos_properties_test.go:93:2: unexported-naming: the symbol RepoCustomProperty is local, its name should start with a lowercase letter (revive)
        RepoCustomProperty := []*CustomPropertyValue{
        ^
github/issues_test.go:473:5: bool-literal-in-expr: omit Boolean literal in expression (revive)
        if i.IsPullRequest() == true {
           ^
github/issues_test.go:477:5: bool-literal-in-expr: omit Boolean literal in expression (revive)
        if i.IsPullRequest() == false {
           ^
github/repos_rules.go:407:6: unexported-naming: the symbol RepositoryRule is local, its name should start with a lowercase letter (revive)
        var RepositoryRule rule
            ^
github/orgs_codesecurity_configurations_test.go:330:4: var-naming: struct field SelectedRepositoryIDS should be SelectedRepositoryIDs (revive)
                        SelectedRepositoryIDS []int64 `json:"selected_repository_ids,omitempty"`
                        ^
github/github_test.go:1156:5: time-equal: use !resp.Rate.Reset.UTC().Equal(reset) instead of "!=" operator (revive)
        if resp.Rate.Reset.UTC() != reset {
           ^
github/github_test.go:1266:5: time-equal: use !resp.Rate.Reset.UTC().Equal(reset) instead of "!=" operator (revive)
        if resp.Rate.Reset.UTC() != reset {
           ^
github/github_test.go:1306:5: time-equal: use !rateLimitErr.Rate.Reset.UTC().Equal(reset) instead of "!=" operator (revive)
        if rateLimitErr.Rate.Reset.UTC() != reset {
           ^
github/github_test.go:1364:5: time-equal: use !rateLimitErr.Rate.Reset.UTC().Equal(reset) instead of "!=" operator (revive)
        if rateLimitErr.Rate.Reset.UTC() != reset {
           ^
github/orgs_properties.go:70:4: early-return: if c { ... } else { ... return } can be simplified to if !c { ... return } ... (move short variable declaration to its own line if necessary) (revive)
                        if str, ok := item.(string); ok {
                                strSlice[i] = str
                        } else {
                                return errors.New("non-string value in string array")
                        }
github/code-scanning.go:6:9: filename-format: Filename code-scanning.go is not of the format ^[_a-z][_a-z0-9]*.go$. (revive)
package github
        ^
github/code-scanning_test.go:6:9: filename-format: Filename code-scanning_test.go is not of the format ^[_a-z][_a-z0-9]*.go$. (revive)
package github
        ^

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.30%. Comparing base (2b8c7fa) to head (c7a9af3).
Report is 170 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3345      +/-   ##
==========================================
- Coverage   97.72%   92.30%   -5.42%     
==========================================
  Files         153      176      +23     
  Lines       13390    15031    +1641     
==========================================
+ Hits        13085    13874     +789     
- Misses        215     1064     +849     
- Partials       90       93       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @alexandear!
LGTM.
Merging.

@gmlewis gmlewis merged commit 77dcbf3 into google:master Nov 12, 2024
6 of 7 checks passed
@alexandear alexandear deleted the refactor/enable-revive-linter branch November 12, 2024 07:13
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants