-
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
[GH-159|GH-160] - argument matcher analyzers improvements - handling Arg.Do and When on property level #169
Conversation
Pull Request Test Coverage Report for Build 439
💛 - Coveralls |
return; | ||
} | ||
|
||
if (IsPrecededByReceivedLikeMethod(syntaxNodeContext, syntaxNode)) |
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.
@dtchepak Considering the fact that NS1004 will be reported for cases when (for instance) Arg.Is
is used in following context
substitute.Type = Arg.Is("sth");
instead of
substitute.Received().Type = Arg.Is("sth");
even if Type property is virtual, should we change default message
[NS1004] Argument matcher used with a non-virtual member of a class.
to sth else?
Documentation clearly states that
This violation can also be reported if an argument matcher is used for something other than setting return values, checking received calls, or configuring callbacks. See [NSubstitute's argument matcher documentation](https://nsubstitute.github.io/help/argument-matchers/#how_not_to_use_argument_matchers) for more information.
but maybe we should "promote" this message (or shorter one) to warning visible during the build?
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 think ideally this should be a different error ("5003 Misused argument matcher"?).
The non-virtual cases are very clear in terms of cause and fix. The misuse case is a lot more subtle.
Maybe can tackle that as a separate issue so this fix can be merged first?
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.
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.
Closes #159 #160