We should enable at least some style checks during the build.
This will avoid people to have to come back and fort with the PR iterations as they can be spotted by the build.
src/devices/Directory.Build.props commented out code for style cop checking is re-enabled (added as part of one of the style cop PRs)cc: @joperezr
@krwq: I would like to pick this up and enable it at least for core. (I'll see how far I get). I'll try to come up with a reasonable rule set which requires only minimal changes (and no api changes of course) for now.
Some default rules we obviously break (such as SA1309 - Field names should not begin with underscores - where we go for SX1309 instead, which is just the opposite), but for some I'm not sure.
@pgrawehr yes, you can go ahead with that. Please split rules into 3 parts (add a comment or something so we can pick them up whenever someone feels like doing the work):
also you can assume at minimum we want what corefx has:
https://github.com/dotnet/runtime/blob/master/eng/CodeAnalysis.ruleset
and you can also see how they have enabled it
A solution with all the projects can be created automatically using:
dotnet new sln -n Allprojects
for /R %r in (*.csproj) do dotnet sln AllProjects.sln add %r
Some further modifications may be required to configure the correct build target afterwards.
With PRs #892, #894, #895, #897, #898, #900, #901, #902, #903 and #904, a basic set of style cop rules was defined and the files fixed (with some exceptions due to potentially breaking API changes).
The rules enabled in https://github.com/dotnet/runtime/blob/master/eng/CodeAnalysis.ruleset are also enabled here (plus some more), but with a few exceptions (note that the ruleset there only mentions the rules explicitly disabled):
var a = new SomeStruct() or var a = default(SomeStruct) (the later being allowed by the rule) doesn't really make a difference. In addition SX1101 "Do not prefix local members with this" should be enabled as well.
@pgrawehr I think you've already fixed all tabs, right?
Yes, that should be fine. And it's also validated now (I think I even tested that the rule works).
Let me know if we should close this or if you're planning some more work here. For SuppressMessage we can create a separate issue on another occasion
I will do a quick check whether any of the rules mentioned above can be enabled without lots of side effects, but after that, I think we can close it and focus on content again for a while. I guess we should for instance come to a conclusion on the "board" discussion.
But it's good this is done now before the holidays, so if people find time to contribute now, they won't be pushed back by lots of merge conflicts.
@pgrawehr I feel like Board is going to be a longer design conversation :smile: Agreed on holidays although on the other hand it's vacation season for us and I'm soon gonna be on parental leave (I'll likely still be a bit active)
I see. This could cause a bit of a PR backlog then, if you are off and @joperezr is the only one left reviewing. But we'll see. This is vacation season here as well (most offices are closed between xmas and new year), that's why I feel people might have time to contribute.
@pgrawehr I'll likely still review some PRs when I got some spare time but can't promise anything..
@krwq what is left from this issue? I feel now all is reinforced, at least when I'm coding, I can clearly see Stylecop not being happy with tabs, extra spaces and other missing comments :-)
The last point on the OP should probably be checked once. I'll give it a go next week.
Most helpful comment
A solution with all the projects can be created automatically using:
Some further modifications may be required to configure the correct build target afterwards.