Skip to content

Fix potential spacing problems when removing parentheses#453

Closed
sharwell wants to merge 3 commits intoDotNetAnalyzers:masterfrom
sharwell:fix-449
Closed

Fix potential spacing problems when removing parentheses#453
sharwell wants to merge 3 commits intoDotNetAnalyzers:masterfrom
sharwell:fix-449

Conversation

@sharwell
Copy link
Member

@sharwell sharwell commented Feb 6, 2015

This is an alternative solution to #449. It reuses the tests originally provided in #450.

The new implementation detects a spacing error by writing the new syntax root to a string, and then parsing it to verify that the parsed version is the same as expected. If these trees are not considered equivalent (for any reason), the algorithm assumes a spacing error resulted in the combination of one or more nodes and a space is added where the opening parentheses once was.

@pdelvo
Copy link
Member

pdelvo commented Feb 7, 2015

I have a look at this next week. I don't have time right now

@sharwell
Copy link
Member Author

sharwell commented Feb 7, 2015

Thanks 👍

@sharwell sharwell modified the milestones: 1.0.0, 1.0.0 Alpha 2 Feb 8, 2015
@sharwell
Copy link
Member Author

sharwell commented Feb 8, 2015

It turns out this situation affects other diagnostics as well. I'm changing the milestone to post-alpha 2 to give us more time to find a general solution. For example, the code fix for SA1101 takes this input:

return@instanceField;

And turns it into this:

returnthis.@instanceField;

@sharwell
Copy link
Member Author

sharwell commented Apr 7, 2015

Superseded by #646.

@sharwell sharwell closed this Apr 7, 2015
@sharwell sharwell modified the milestone: 1.0.0 Nov 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants