-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add two new rules, to validate the
Success
and HaveOccurred
matchers
* Makes sure the `Succeed()` matcher only accepts a single error value, or a function that recieves a Gomega object as its first parameter, in async assertions. * force usage of `Succeed` for functions, and `HaveOccurred` for values. Added a new command line flag: `--force-succeed=true`, to enable the second rule (the rule is disabled by default).
- Loading branch information
Showing
23 changed files
with
650 additions
and
86 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package actual | ||
|
||
import ( | ||
"github.com/nunnatsa/ginkgolinter/internal/gomegahandler" | ||
"github.com/nunnatsa/ginkgolinter/internal/interfaces" | ||
gotypes "go/types" | ||
) | ||
|
||
func getAsyncFuncArg(sig *gotypes.Signature) ArgPayload { | ||
argType := FuncSigArgType | ||
if sig.Results().Len() == 1 { | ||
if interfaces.ImplementsError(sig.Results().At(0).Type().Underlying()) { | ||
argType |= ErrFuncActualArgType | ErrorTypeArgType | ||
} | ||
} | ||
|
||
if sig.Params().Len() > 0 { | ||
arg := sig.Params().At(0).Type() | ||
if gomegahandler.IsGomegaType(arg) && sig.Results().Len() == 0 { | ||
argType |= FuncSigArgType | GomegaParamArgType | ||
} | ||
} | ||
|
||
if sig.Results().Len() > 1 { | ||
argType |= FuncSigArgType | MultiRetsArgType | ||
} | ||
|
||
return &FuncSigArgPayload{argType: argType} | ||
} | ||
|
||
type FuncSigArgPayload struct { | ||
argType ArgType | ||
} | ||
|
||
func (f FuncSigArgPayload) ArgType() ArgType { | ||
return f.argType | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.