Resharper code comment creates conflict with StyleCop
private void SomeFunc()
{
do
{
// some code here
}
while(true);
}
R# marks that the function never returns, now I comment it so R# will ignore it.
private void SomeFunc()
{
do
{
// some code here
}
// ReSharper disable FunctionNeverReturns
while(true);
// ReSharper restore FunctionNeverReturns
// ReSharper restore FunctionNeverReturns
}
But now I have a problem to comply with SA1515 (Singleline comments) or SA1108 (comment in bracketed statement).
Please sign in to leave a comment.
I noticed this too. When I disable a ReSharper message, I reformat the comments by myself. I think the varieties where the comments can be inserted are to much to make them fit SA-rules
By the way: I seldom use this disableing feature. I don't like the comments in my code. If there is a rule I generally don't like, I turn it off. In all other cases I make my code fit the ReSharper rules.
Regards
Susanne
I just think that there should be alternate ways to disable messages, like other comment types (//, /* */), pragmas, attributes, more flexible scoping, etc.,, that would allow disabling messages according to the situation.
Sometimes you just cant make the code fit the rules (in this case i just need an non-returning loop, no matter how I define it, R# will tell me that it IS non-returning). And disabling the rule generally is not advisable.
Liebe Grüße nach Deutschland.
Andreas
Hello,
There're pragmas available, but R# wouldn't insert them by default anymore.
Standard C# warning pragmas could be used, like this:
#pragma warning disable FunctionNeverReturns
—
Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”