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: lint issues, modernize codebase #922

Merged
merged 2 commits into from
Mar 29, 2025
Merged

fix: lint issues, modernize codebase #922

merged 2 commits into from
Mar 29, 2025

Conversation

caarlos0
Copy link
Member

No description provided.

@caarlos0 caarlos0 added the enhancement New feature or request label Mar 28, 2025
@caarlos0 caarlos0 requested a review from Copilot March 28, 2025 22:46
@caarlos0 caarlos0 self-assigned this Mar 28, 2025
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 28, 2025
Copy link

Deploying nfpm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 577b0a8
Status: ✅  Deploy successful!
Preview URL: https://069e4842.nfpm.pages.dev
Branch Preview URL: https://lint.nfpm.pages.dev

View logs

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR modernizes the codebase by updating lint issues and refactoring tests and package fields. The changes include updating assertion functions in tests, replacing outdated references to Overridables with direct field accesses, and utilizing the Go slices package for cleaner code.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
rpm/rpm_test.go Updated assertions using require.Len
nfpm_test.go Replaced require.Equal with require.Empty and direct field accesses
nfpm.go Refactored environment variable expansion using slices.Delete and updated field accesses
ipk/ipk_test.go Updated references from Overridables to direct fields
internal/sign/pgp.go Optimized loop iteration with range over byte slices
internal/glob/glob_test.go Replaced require.Equal with require.Empty for empty strings
internal/glob/glob.go Refactored longest common prefix logic using a helper function for min length
files/fs.go Replaced explicit loop with slices.Contains
files/files_test.go Modified loop constructs for cleanup and error checking (issue reported)
files/files.go Updated Sys() method signature to use any
deprecation/deprecation.go Updated Printf signature to accept any type
deb/deb.go Refactored script references from Overridables to direct fields
arch/arch.go Optimized isOneOf check with slices.Contains
.golangci.yml Updated linter configuration and added new exclusions

}
for i := 0; i < min; i++ {
minlen := min(len(a), len(b))
for i := range minlen {
Copy link
Preview

Copilot AI Mar 28, 2025

Choose a reason for hiding this comment

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

Using 'for i := range minlen' is invalid since minlen is an integer. Replace it with a traditional for loop such as 'for i := 0; i < minlen; i++ {'.

Suggested change
for i := range minlen {
for i := 0; i < minlen; i++ {

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

@@ -282,7 +282,7 @@ contents:
errs := make(chan error, 10)
t.Cleanup(func() { close(errs) })
var wg sync.WaitGroup
for i := 0; i < 10; i++ {
for range 10 {
Copy link
Preview

Copilot AI Mar 28, 2025

Choose a reason for hiding this comment

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

The expression 'for range 10' is invalid because an integer cannot be directly ranged over. Revert to the original 'for i := 0; i < 10; i++ {' loop construct.

Suggested change
for range 10 {
for i := 0; i < 10; i++ {

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

@@ -298,7 +298,7 @@ contents:
}
wg.Wait()

for i := 0; i < 10; i++ {
for range 10 {
Copy link
Preview

Copilot AI Mar 28, 2025

Choose a reason for hiding this comment

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

The expression 'for range 10' is invalid due to 10 not being an iterable type; use a standard loop syntax, e.g., 'for i := 0; i < 10; i++ {'.

Suggested change
for range 10 {
for i := 0; i < 10; i++ {

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Copy link

codecov bot commented Mar 28, 2025

Codecov Report

Attention: Patch coverage is 95.91837% with 2 lines in your changes missing coverage. Please review.

Project coverage is 69.29%. Comparing base (3f640c7) to head (577b0a8).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
nfpm.go 94.73% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #922      +/-   ##
==========================================
- Coverage   69.42%   69.29%   -0.13%     
==========================================
  Files          22       22              
  Lines        3133     3120      -13     
==========================================
- Hits         2175     2162      -13     
  Misses        745      745              
  Partials      213      213              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@caarlos0 caarlos0 merged commit c94b6a1 into main Mar 29, 2025
49 checks passed
@caarlos0 caarlos0 deleted the lint branch March 29, 2025 11:57
@github-actions github-actions bot added this to the 2.38.0 milestone Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant