-
Notifications
You must be signed in to change notification settings - Fork 96
fix: lint #665
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
base: main
Are you sure you want to change the base?
fix: lint #665
Conversation
Re-enabled the dupl linter and refactored TestCheckResourceIntegration to eliminate code duplication by: - Creating helper functions for common nginx container spec and pod creation - Extracting shared expected object into a variable - Simplifying test cases to use these helpers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> Signed-off-by: Marcin Owsiany <porridge@redhat.com>
Re-enabled the gosmopolitan linter and fixed issues by adding nolint comments for legitimate Unicode test data in values_test.go. The Chinese characters (测试) are intentionally used to test Unicode support functionality. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> Signed-off-by: Marcin Owsiany <porridge@redhat.com>
Re-enabled the nolintlint linter. No issues found - the previously reported issues appear to have been resolved by other changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> Signed-off-by: Marcin Owsiany <porridge@redhat.com>
Re-enabled the staticcheck linter and fixed 7 issues: - Simplified embedded field access by removing unnecessary ObjectMeta and TLSClientConfig selectors - Changed generic switch to tagged switch in serialization.go for better type safety - Updated event handling functions to directly access embedded fields 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> Signed-off-by: Marcin Owsiany <porridge@redhat.com>
Signed-off-by: Marcin Owsiany <porridge@redhat.com>
The line length issues that were causing lll linter to be disabled have been resolved, allowing the linter to be re-enabled successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> Signed-off-by: Marcin Owsiany <porridge@redhat.com>
- Re-enabled errcheck linter in .golangci.yml - Fixed 10 errcheck violations across multiple files by properly handling unchecked error returns from Close() methods and os.RemoveAll() - Used //nolint:errcheck comments for defer cleanup operations where error handling would not be meaningful - Properly checked f.Close() error in tar.go where it matters for file integrity All errcheck violations are now resolved and linter passes successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> Signed-off-by: Marcin Owsiany <porridge@redhat.com>
Removed the temporary disable comment for revive linter. The linter was previously disabled due to 38 issues which will be addressed in subsequent commits. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> Signed-off-by: Marcin Owsiany <porridge@redhat.com>
Added comprehensive package-level documentation following Go conventions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> Signed-off-by: Marcin Owsiany <porridge@redhat.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> f Signed-off-by: Marcin Owsiany <porridge@redhat.com>
Fixed revive unused-parameter warnings in dummy test functions by renaming unused 't *testing.T' parameters to '_ *testing.T'. These test functions exist only to satisfy coverage tools and don't use the testing parameter. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> Signed-off-by: Marcin Owsiany <porridge@redhat.com>
Added targeted nolint:revive comments for package naming issues: - internal/http: conflicts with standard library 'http' package - internal/utils/docker.go: 'utils' package name considered meaningless Fixing these would require some more extensive changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> Signed-off-by: Marcin Owsiany <porridge@redhat.com>
Apparently which files get complained about is non-deterministic. Signed-off-by: Marcin Owsiany <porridge@redhat.com>
internal/harness/harness.go
Outdated
| } | ||
|
|
||
| defer f.Close() | ||
| defer f.Close() //nolint:errcheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be important to check for errors here? error on closing here could indicate that the config was not successfully written, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent point, I will change the code to propagate errors from Close on writable filehandles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a proper look at the Close() calls. It would be great if you could review the last commit @mclasmeier 🙏🏻
internal/http/client.go
Outdated
| return err | ||
| } | ||
| defer out.Close() | ||
| defer out.Close() //nolint:errcheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as before, is ignoring err here safe?
mclasmeier
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm through. Just a few Close() questions, besides that lgtm.
Signed-off-by: Marcin Owsiany <porridge@redhat.com>
| }, | ||
| }, w) | ||
| if err != nil { | ||
| w.Close() //nolint:errcheck // We do not care if closing failed in addition to writing, just preventing leaks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, any particular reason why you are not using a deferred anonymous function, which does the Close() and assigns it to err in case err != nil? That way we wouldn't need to keep track of adding Close() calls to every early return.
What this PR does / why we need it:
The recent bump of golangci-lint that I squeezed into #662 (which was mandatory due to the bumped go version) was somewhat rudimentary to keep the scope limited, and turned out to break the config a little. Me and Claude fixed it all in this PR. Reviewing by commit is highly recommended.