-
Notifications
You must be signed in to change notification settings - Fork 6
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 bug: false positive warning for typed function calls #92
Conversation
@pohly, would you mind to take a look at this fix? |
Pull Request Test Coverage Report for Build 5391259784
💛 - Coveralls |
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 can confirm that this fixes the issue in Kubernetes. Thanks!
Just some minor nits.
ginkgo_linter.go
Outdated
@@ -371,6 +368,19 @@ func checkAsyncAssertion(pass *analysis.Pass, config types.Config, expr *ast.Cal | |||
return true | |||
} | |||
|
|||
func isValidFuncCallInAsync(t gotypes.Type) bool { |
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 was initially confused about the FuncCall
here. This isn't checking the function call, it's checking the type of the return value of the function call, is it?
Perhaps rename to isValidAsyncValueType
?
func isValidFuncCallInAsync(t gotypes.Type) bool { | ||
switch t.(type) { | ||
// allow functions that return function or channel. | ||
case *gotypes.Signature, *gotypes.Chan, *gotypes.Pointer: |
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: I find the intention easier to read when the return true
is here instead of below.
When calling a function that return a type in the async assertion (eventually/constantly) body, if this type is a function, the linter fiels to recognize it and fire a warning. This PR fixes this bug, by checking the underline types.
Description
When calling a function that return a type in the async assertion (eventually/constantly) body, if this type is a function, the linter fails to recognize it and fire a warning.
This PR fixes this bug, by checking the underline types.
Fixes #91
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist:
@nunnatsa