Skip to content

golangci-lint: fix invalid nakedret config, disallow for any func length - #5836

Merged
thaJeztah merged 3 commits into
docker:masterfrom
thaJeztah:nakedret
Feb 18, 2025
Merged

golangci-lint: fix invalid nakedret config, disallow for any func length#5836
thaJeztah merged 3 commits into
docker:masterfrom
thaJeztah:nakedret

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

cli/internal/oauth: don't use naked returns (nakedret)

cli/internal/oauth/jwt.go:62:3: naked return in func `GetClaims` with 9 lines of code (nakedret)
return
^
cli/internal/oauth/jwt.go:67:2: naked return in func `GetClaims` with 9 lines of code (nakedret)
return
^

cli/command/container: don't use naked returns (nakedret)

cli/command/container/cp.go:206:3: naked return in func `resolveLocalPath` with 5 lines of code (nakedret)
return
^

golangci-lint: fix invalid nakedret config, disallow for any func length

The regex was added before we migrateed from gometalinter in
dbd96ba (#620), and got migrated to golangci-lint
in b7e06f2 (#2173). The format used for the config
was invalid, and migrating it to the right format didn't make a difference,
so we can remove it.

As naked returns are generally not desirable, also setting the minimum func
length to 0 (i.e., don't allow any naked returns), instead of the default

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

 cli/internal/oauth/jwt.go:62:3: naked return in func `GetClaims` with 9 lines of code (nakedret)
return
^
cli/internal/oauth/jwt.go:67:2: naked return in func `GetClaims` with 9 lines of code (nakedret)
return
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
 cli/command/container/cp.go:206:3: naked return in func `resolveLocalPath` with 5 lines of code (nakedret)
return
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The regex was added before we migrateed from gometalinter in
dbd96ba, and got migrated to golangci-lint
in b7e06f2. The format used for the config
was invalid, and migrating it to the right format didn't make a difference,
so we can remove it.
As naked returns are generally not desirable, also setting the minimum func
length to 0 (i.e., don't allow any naked returns), instead of the default
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@codecov-commenter

codecov-commenter commented Feb 18, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 45.45455% with 6 lines in your changes missing coverage. Please review.

Project coverage is 59.17%. Comparing base (88a019a) to head (1c8243c).
Report is 46 commits behind head on master.

❌ Your patch status has failed because the patch coverage (45.45%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@ Coverage Diff @@## master #5836 +/- ##
==========================================
- Coverage 59.18% 59.17% -0.01% 
==========================================
Files 352 352 Lines 29548 29552 +4 ==========================================
+ Hits 17487 17488 +1 - Misses 11080 11082 +2 - Partials 981 982 +1 

@thaJeztahthaJeztah added this to the 28.0.0 milestone Feb 18, 2025
@thaJeztah
thaJeztah merged commit bfd49b1 into docker:masterFeb 18, 2025
@thaJeztah
thaJeztah deleted the nakedret branch February 18, 2025 12:15
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@thaJeztah@codecov-commenter@vvoland