Skip to content
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

Code fix for SA1009 removes trivia #1187

Closed
sharwell opened this issue Aug 11, 2015 · 4 comments · Fixed by #1188
Closed

Code fix for SA1009 removes trivia #1187

sharwell opened this issue Aug 11, 2015 · 4 comments · Fixed by #1188
Assignees
Milestone

Comments

@sharwell
Copy link
Member

When the code fix for SA1009 is executed on the following call, the comment is removed.

x.MethodName(
    arg1
    , _ => Assert.True(true) // comment
    , _ => Assert.True(true);

Actual result

testCallBack.AssertOnCallbackBeforeAndAfter(
    TimeOutMs
    , ev => Assert.True(true) , ev => Assert.AreEqual(isSuccess, ev.Success));

Expected result

I'm actually not sure here. Perhaps no code fix offered? I'm open to suggestions.

@sharwell sharwell added the bug label Aug 11, 2015
@sharwell sharwell added this to the 1.0.0 Beta 6 milestone Aug 11, 2015
@vweijsters
Copy link
Contributor

I think no code fix should be offered. The comment should not be removed as it may contain important information. The location of the comment should also not be changed significantly as that could have an impact on the message in the comment as well.

In the example there is a trivial fix, even with keeping the comment, but that is not the general case.
It will be a lot of work to anticipate all possible tokens following the closing parenthesis and it may not always be possible to offer a proper fix that respects the observations above and that does not introduce another diagnostic.

As a side note: the actual result above would also produce SA1001, due to the spaces surrounding the comma, something that should be avoided as well.

@Noryoko
Copy link
Contributor

Noryoko commented Aug 11, 2015

SA1113 and SA1001 are reported when run through classic StyleCop. SA1009 is not reported.

@sharwell
Copy link
Member Author

@Noryoko you are talking about StyleCop classic?

@Noryoko
Copy link
Contributor

Noryoko commented Aug 11, 2015

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants