-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add StyleCop including some rules. #5
Comments
@gep13 @AdmiringWorm I feel I need a bit of input (and currently only we three are using CakeContrib.Guidelins): rules-file or editorconfig
So my idea is this:
This leaves the project free to have a more general editorconfig on sln-level. Only drawback I see is that one could technically have a limitless amout of rules-files but the number of editorconfigs is limited to the number of folders in a project. Would that be ok with you? what rules to setI am a bit reluctant to impose "my" rules (i.e. formatting and rules like Cake.7zip) as a starter-package to discuss changes. Is there a more "seasoned" project whose style and rules I copy to start with? |
I think what you have suggested here sounds like a good approach, I would be happy to see it implemented as such. In terms of what rules to apply, and which ones to turn off, bottom line, we are never going to please everyone, there is always going to be disagreement 😄 I would suggest starting out small, and only adding the bare minimum of rules that we can all agree on, and from there, look to expand out to include other rules. Thoughts? |
Looking at "my" rules from Cake.7zip: There are only three StyleCop rules in there - two of which I would copy:
The rest from that rules is Microsoft.NetFramework.Analyzers and Microsoft.CodeAnalysis.FxCopAnalyzers. As for the editorconfig that was exported from VS and only sightly modified (I think) - so I'd use that and see what we get. 😄 |
Please make sure that existing rules and editorconfig files do not get overwritten. |
@nils-a sounds like a good starting point. I always get this wrong, so I have to ask... Does this:
cause problems when also developing on a non-WIndows OS? /cc @AdmiringWorm |
I wouldn't know. I have not done any real development on non-windows in a really long time. |
It shouldn't really cause any problems, but it will/may cause annoyance to Unix users, especially if the gitattributes file do not reflect the same as the editorconfig file. TBH, I am a bit against copying a editorconfig file into the repository. |
@AdmiringWorm I tend to agree, though I'd love to give "some" guidance. I thought much about this in last days (thats probably why I've been avoiding this issue ;-) ) and I'm also not so sure about copying the .editorconfig any longer. Thing is: If we copy an editorconfig next to the csproj (after testing if one is already there and such) we could nontheless "override" settings already present in an .editorconfig one level up (say sln-level). So while I can technically avoid overriding a physical file (like @Jericho wanted) it might well be we're "destroying" a carefully maintained set of rules. So to catch up on @AdmiringWorm last sentence: It is also possible to emit a warning if stylecop is not referenced and/or no .editorconfig is found. |
Personally, that is the approach I would like. Especially considering that I typically have a root editorconfig file in the root of the repository, and only separate editorconfig files for the test projects. |
Added a rules (CCG0005, CCG0006) to check for stylecop
As mentioned in cake-contrib/Home#11 a dependency to stylecop should be added, including some rules.
The text was updated successfully, but these errors were encountered: