Will StyleCop be releasing soon for C#6?

Feb 4 at 12:05 AM
Hi,
StyleCop has been brilliant over recent years, having saved so many resource hours I just can't total.

Since there has been no update since 2012.
And our division/org is shifting to C#6, we are encountering a decision whether to stay.
For C#6, will StyleCop be releasing soon?

Thanks, Stephen
Coordinator
Feb 4 at 12:07 PM
About a month ago, the existing coordinator added me and a handful of other people to the project. I have been cleaning up the last ~2 years of build up, and yesterday I published an alpha build (4.7.50) that adds support for VS2015, updates R# 8 support to 8.2.3, and includes a bunch of other pull requests.

The next thing on my list is to add support for C# 6, but unfortunately I have no ETA for that.
Developer
Feb 4 at 12:48 PM
Edited Feb 4 at 12:51 PM
You can try visual-stylecop, this is a fork of current repo and support vs2015 and C#6 :

Source: https://github.com/Visual-Stylecop/Visual-StyleCop
Install: https://visualstudiogallery.msdn.microsoft.com/cac2a05b-6eb6-4fa2-95b9-1f8d011e6cae

For msbuild you can use: https://www.nuget.org/packages/Visual-StyleCop.MSBuild/

Or you can try stylecop analyzer.

@csdahlberg, you can copy or use my code if it can help you ;)
Feb 4 at 5:40 PM
Edited Feb 5 at 2:32 PM
If you are in 2015, it is a no brainer to move to Roslyn based analyzers!

https://github.com/DotNetAnalyzers/StyleCopAnalyzers

A good discussion on the topic:
https://github.com/StyleCop/StyleCop/issues/10
Feb 14 at 9:28 PM
Edited Feb 14 at 10:17 PM
Thanks Guys.

FYI that we have our own NuGet package that every solution installs that wraps-up StyleCop 4.7.49 binary nicely, contains all our rule settings and automatically injects required one liners into .csprojs to reference a build target file. This enforces StyleCop at build time on any machine whether or not StyleCop is installed or not - we also package FxCop (code analysis) in the same package and manner.

Would prefer to stay on StyleCop vanilla for simplicity, maintainability and reliabilty and just update the binary as it becomes available and stable.

@felickz thanks for pointer, will take a look.
@ptit_tof75 have tried visual style cop but only quick check, will take a further peek.
@csdahlberg great news! tip to note that still using 4.7.49 with R# 9 and the R# StyleCop plug-in things worked fine - so would recommend checking into that plug-in. Furthermore, if you could share any rough timelines for C#6 support that will help?

Thanks, Stephen
Coordinator
Feb 16 at 3:07 AM
@stepfitz - I'm planning to merge C# 6 support from the Visual-StyleCop fork on GitHub, so hopefully that won't take too long. I do also want to fix the error when launching the settings editor from a context menu in VS2015 before releasing the next version. It may be a few weeks before I can complete them as I won't have much free time for a while (selling a house is a lot of work!).
Feb 22 at 9:19 PM
Edited Feb 22 at 9:28 PM
@csdahlberg brilliant news (and g.luck with the house!), great to see you and @ptit_tof57 combining forces & getting the best into vanilla - super kudos! please do keep posted here... am sure lots of silent eyes are peeking & secretly simply super excited about this :)
Feb 23 at 12:19 PM
@csdahlberg, i second @stepfitz, i really enjoy vanilla stylecop and use it in a large project currently; thanks to your contribution we already have it working in vs 2015 (save for editing the stylecop settings files) we just want the c# syntax. Stylecop.Analyzers is nowhere near the flexibility and R# integration is just not there. Keep up the good work!
Feb 23 at 5:54 PM
Same here! I'm on a team that has recently upgraded from VS2012 to VS2015 and we were using Stylecop both in Visual Studio and on the build server (TeamCity), so we're sort of on hold with complete integration until a new Stylecop version comes out. Im also wondering if there's something to help out with, any easy issues up for grabs?
Coordinator
Feb 23 at 6:08 PM
carlberg wrote:
Im also wondering if there's something to help out with, any easy issues up for grabs?
I already have C# 6 support merged from Visual-StyleCop on my local machine, but some unit tests are failing. Hopefully it won't take much work to troubleshoot and fix those tests and the settings editor error in VS2015, then I'll publish a new build. With me being completely done selling my house in a few days, I should be able to spend some time on it in the near future.
Mar 8 at 9:38 PM
@csdahlberg hope the house is locked and worry out of the way! for this lower pri stuff here, hehe :) any secret/sneak update?
Coordinator
Mar 8 at 11:01 PM
Before the next build, I still want to:
  • Fix the error when launching the settings editor from VS2015 (I now know what the problem is)
  • Fix two or three rules that incorrectly flag new C# 6 syntax as violations
  • Merge in support for R# 9
I can hopefully get the first two items done tonight. I'm not sure about the third one, but if it ends up taking me a while I might release a build just to get the first two out there.
Mar 10 at 10:14 PM
Great news... sounds like you've nearly hit the significant milestone!
Mar 14 at 7:06 AM
From our side the c#6 support prevails everything else... existing plugin for R# 10.1 works just fine with the current 'alpha' build; and settings can be edited manually.. We have just migrated to VS2015 from VS2010 and now in absence of c#6 feature support the team is seriously considering dropping StyleCop altogether, which would be a shame. Anything we can do to help here?
Coordinator
Mar 14 at 4:26 PM
Mar 15 at 4:19 AM
@csdahlberg, Thank you so much for this! The c#6 syntax does, indeed, work now. Sadly, this build broke the older ReSharper plugin (https://github.com/kubiix/ReSharper.StyleCop), this used to work just fine with 4.7.50 (alpha) build. (I am not complaining, just letting you know).
Coordinator
Mar 15 at 12:29 PM
I did merge in a R# 9.2 project, but haven't had a chance to test, make sure it follows R# naming/versioning best practices, etc.

I added it to the release so you can try it out if you want. Download StyleCop.ReSharper920.4.7.51-beta1.nupkg, then add the folder it's in as a R# extension source.
Mar 15 at 1:37 PM
Hi Chris,

Thanks for this.

Unfortunately so far i wasn't able to add it to R# 10, it just doesn't list it as a valid package. i will try a few more things, too.
Developer
Mar 15 at 2:43 PM
Edited Mar 15 at 3:23 PM
Zaitsman,

The package takes a dependency on Wave3.0, so it will list as extension only in R# 9.2.

To properly support R# 10, we need to compile the plugin code against latest r# binaries and produce a package that takes a dependency on Wave4.0.

This will take a bit of time.
Mar 16 at 12:35 AM
amazing news! looking forward to taking it for a test drive..
Mar 16 at 12:53 PM
I am very happy to see some news about R# 10 integration.

I hope that we will continue to receive this kind of good news.

Thanks for your work :)
Mar 20 at 8:53 PM
@csdahlberg/SanjayGuntur,

Thanks for the amazing work guys!

A couple of things i noticed:
  1. If i open R# settings, click Stylecop, I see the 'your settings are not fully compatible' warning. I click on the 'reset settings' button and the whole view is empty, so i can't click on 'Save' afterwards - doesn't work
  2. Seems the new Dictionary initialization syntax is not recognised, like so:
var dic = new Dictionary<string, string> { ["key"] = "value" };
The above causes SA0102.
Coordinator
Apr 21 at 5:17 AM
Finally released 4.7.52.

the issue with ReSharper settings is still there, but i'm not sure when i'd be able to get to it. anyone feel like taking that on?