-
Notifications
You must be signed in to change notification settings - Fork 454
linters: enable testifylints and fix issues #3769
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Issues were fixed using 'golangci-lint run --fix'. Signed-off-by: Mahe Tardy <[email protected]>
Fixes testifylint require-error: for error assertions use require. Ignore the linter in three weird cases and simplify one case. Signed-off-by: Mahe Tardy <[email protected]>
Fixes errors: testifylint len: use require.Len testifylint empty: use assert.NotEmpty testifylint empty: use assert.Empty Signed-off-by: Mahe Tardy <[email protected]>
Fixes: pkg/policyconf/test/mode_test.go:96:3 testifylint formatter: remove unnecessary fmt.Sprintf pkg/policyconf/test/mode_test.go:113:3 testifylint formatter: remove unnecessary fmt.Sprintf pkg/policyconf/test/mode_test.go:193:3 testifylint formatter: remove unnecessary fmt.Sprintf pkg/policyconf/test/mode_test.go:222:3 testifylint formatter: remove unnecessary fmt.Sprintf Signed-off-by: Mahe Tardy <[email protected]>
Fixes: pkg/sensors/exec/cgroups_test.go:800:2 testifylint useless-assert: meaningless assertion Signed-off-by: Mahe Tardy <[email protected]>
1016b8b
to
09db951
Compare
will-isovalent
approved these changes
May 26, 2025
For some I blindly replaced |
167810c
to
431f0f5
Compare
kevsecurity
reviewed
May 27, 2025
kevsecurity
reviewed
May 27, 2025
Fixes: pkg/ratelimit/ratelimit_test.go:19:2 testifylint float-compare: use assert.InEpsilon (or InDelta) pkg/ratelimit/ratelimit_test.go:20:2 testifylint float-compare: use assert.InEpsilon (or InDelta) pkg/ratelimit/ratelimit_test.go:21:2 testifylint float-compare: use assert.InEpsilon (or InDelta) pkg/ratelimit/ratelimit_test.go:22:2 testifylint float-compare: use assert.InEpsilon (or InDelta) pkg/ratelimit/ratelimit_test.go:24:2 testifylint float-compare: use assert.InEpsilon (or InDelta) pkg/ratelimit/ratelimit_test.go:26:2 testifylint float-compare: use assert.InEpsilon (or InDelta) pkg/ratelimit/ratelimit_test.go:29:2 testifylint float-compare: use assert.InEpsilon (or InDelta) pkg/ratelimit/ratelimit_test.go:30:2 testifylint float-compare: use assert.InEpsilon (or InDelta) Co-authored-by: Kevin Sheldrake <[email protected]> Signed-off-by: Mahe Tardy <[email protected]>
Fixes: cmd/tetragon/main_test.go:69:3 testifylint go-require: require must only be used in the goroutine running the test function pkg/sensors/manager_test.go:297:4 testifylint go-require: require must only be used in the goroutine running the test function pkg/sensors/manager_test.go:326:4 testifylint go-require: require must only be used in the goroutine running the test function pkg/sensors/manager_test.go:327:4 testifylint go-require: require must only be used in the goroutine running the test function pkg/sensors/manager_test.go:351:4 testifylint go-require: require must only be used in the goroutine running the test function pkg/sensors/manager_test.go:352:4 testifylint go-require: require must only be used in the goroutine running the test function Signed-off-by: Mahe Tardy <[email protected]>
Signed-off-by: Mahe Tardy <[email protected]>
Fixes: pkg/errmetrics/err_msg_windows_test.go:16:2 testifylint bool-compare: use assert.True pkg/errmetrics/err_msg_windows_test.go:19:2 testifylint bool-compare: use assert.True pkg/ktime/ktime_windows_test.go:16:2 testifylint negative-positive: use assert.Positive pkg/ktime/ktime_windows_test.go:27:2 testifylint negative-positive: use assert.Positive pkg/ktime/ktime_windows_test.go:32:2 testifylint expected-actual: need to reverse actual and expected values pkg/reader/proc/proc_windows_test.go:21:2 testifylint error-nil: use assert.NoError pkg/reader/proc/proc_windows_test.go:31:2 testifylint error-nil: use assert.NoError pkg/reader/proc/proc_windows_test.go:36:2 testifylint error-nil: use assert.NoError pkg/reader/proc/proc_windows_test.go:41:2 testifylint error-nil: use assert.NoError pkg/reader/proc/proc_windows_test.go:46:2 testifylint error-nil: use assert.NoError pkg/reader/proc/proc_windows_test.go:21:2 testifylint require-error: for error assertions use require pkg/reader/proc/proc_windows_test.go:31:2 testifylint require-error: for error assertions use require pkg/reader/proc/proc_windows_test.go:36:2 testifylint require-error: for error assertions use require pkg/reader/proc/proc_windows_test.go:41:2 testifylint require-error: for error assertions use require pkg/reader/proc/proc_windows_test.go:46:2 testifylint require-error: for error assertions use require Signed-off-by: Mahe Tardy <[email protected]>
431f0f5
to
b3dc487
Compare
kevsecurity
approved these changes
May 28, 2025
sayboras
approved these changes
May 28, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fun time!
This fixes many swapping between "expected" and "actual" values which should be nice for debugging and also encourage to use the correct methods (Len/Empty/etc) for more context on debugging. It also fixes a few issues and potential mistakes.