Remove trailing whitespace and enforce StyleCop rule SA1028#625
Conversation
derrickstolee
left a comment
There was a problem hiding this comment.
I think this is a good thing to do! It will be easy for users to fix the problems now that we have the Roslyn-based stylecop.
The only issue I see is the (temporary) struggle of possible merge conflicts. This can be fixed by local rebase or merge that should be easy to do.
|
So my concern is that for history a ton of stuff will have your name on it. Maybe it's just a concern for @jamill really :-). I thought GitHub had a blame again feature but I'm not seeing it. |
@jeschu1 - yes, this is a concern. This is (somewhat) mitigated by:
I would be interested if people think this is worth the trade-off. |
|
The other trade off is we deal with non-functional whitespace changes as we encounter them in individual PRs. not as drastic of a single change, but the impact is spread out over time. |
|
UPDATE @jamill I misread your comment the first time, updating mine 😄
I agree that it's better to do this all at once.
@jamill, are there settings and\or extensions you can recommend for VS, VS for Mac, and VS Code that will strip trailing whitespace automatically? If that can be configured then I'm in favor of making the change in this PR. |
Great question - The StyleCop will flag trailing whitespace, and offer an option to fix it "everywhere", but it is a manual action. There is an |
|
I use Notably, Xcode doesn't support .editorconfig so we'll need to keep in mind that our rules won't be applied to C++ code in ProjFS.Mac. |
kewillford
left a comment
There was a problem hiding this comment.
Since my name is on most blames because I was the last to push all the change to GitHub I am all for this change so some of the blame goes to @jamill. :)
@jamill @nickgra I found this setting in Xcode: In However, I'm guessing StyleCop won't apply to these files anyway.
The |
|
@wilbaker Yep, in Xcode that's the feature we want turned on, but it won't light up automatically when someone is working in our repo with VSCode or VS2017/2019 like an Yes, the Since Jameson is out for the rest of the year, would anyone object to me adopting his commits, rebasing them, adding a .editorconfig file and creating a new PR to get this in? I run into this a fair bit and it frustrates me every time. |
That's good with me, + @jrbriggs for his thoughts. |
Clean up existing instances of trailing whitespace in our codebase and
stop suppressing StyleCop rule SA1028 which enforces no trailing
whitespace:
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md
3acd5bd to
c3cdbc0
Compare
EditorConfig is meant to help define and maintain consistent coding style across different editors and IDEs. A description for EditorConfig can be found at: https://editorconfig.org Visual Studio comes with native support for EditorConfig. https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2017 VS Code doesn't currently support editorconfig out of the box, but it can be enabled with a plugin. EditorConfig.org lists the following plugin: https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig
c3cdbc0 to
161780e
Compare
|
I rebased these changes onto latest and added an EditorConfig file. Visual Studio has native support for EditorConfig (documentation) VS Code does not have native support for EditorConfig, but there is a plug-in that can be installed: EditorConfig for VS Code. A list of other editors that support EditorConfig can be found at EditorConfig. One other observation: While Visual Studio for Windows includes an automatic code fix option for the Roslyn Analyzer, I did not see this option for VS for Mac - which was a bit surprising. /cc @nickgra |

@kewillford had suggested that we open issues to start driving down the number of rules that we have disable in our StyleCop ruleset - and this is a step in that direction. I wanted to see how people felt about this rule, fixing up violations in our code base, and seeing if this will cause disruption to work that is currently in flight. My hope is that the diff itself will be easy to look through, as it only contains whitespace differences for all but 1 file (
GVFS.ruleset, where I remove the override for this rule).Clean up existing instances of trailing whitespace in our codebase and
stop suppressing StyleCop rule SA1028 which enforces no trailing
whitespace:
These changes were generated by applying the StyleCop automatic fixup for SA1028.