Is there a tool that can automatically fix StyleCop and FxCop rules, rather than manually fixing thousands of warning and errors?
There must be one, it is such a good business opportunity!
Is there a tool that can automatically fix StyleCop and FxCop rules, rather than manually fixing thousands of warning and errors?
There must be one, it is such a good business opportunity!
StyleFix will fix many of the violations found by StyleCop.
GhostDoc makes it easy to add comments to your methods.
Lateley I've been using Telerik JustCode. It really helps PREVENT the style issues.
FxCop doesn't come with its own fixing features just yet. Project Roslyn (targeted to be released somewhere after VS11) will provide a new engine for static analysis rules and comes with fixing built in as a feature.
There are a number of tools that provide their own fixing rules. A few have been mentioned before:
These sometimes flag more or other things than FxCop or StyleCop would. And herein lies a danger of conflicting rules. Which is already occurring here and there if you're one tool such as FxCop.
And there are a few open source projects that attempt to provide fixes for the most common FxCop and StyleCop warnings. I haven't tried those for StyleCop, but most of the FxCop auto fixing tools don't really work well, as there are but few FxCop rules that are truly easy to fix.
None of these tools will be able to help you fix custom rules (or rules you've downloaded from other sources, such as MSOCAF or open source projects (FxCopContrib for example) or other Microsoft projects (Such as the rules included in the Open Source Web Service Software Factory CTP).
And, especially with FxCop rules I see that while the thing being flagged, which seems very simple to resolve, actually points to a much larger issue.
This applies a lot less to StyleCop, as the coding style is often not related to the actual underlying implementation or design. And it looks like StylecopFixer is a great add-on if you're not using the Resharper integration which now ships with StyleCop by default.
No, frustratingly. That's why Style Cop is counter-productive. Consistent formatting looks nice, but there's little productivity benefit to it (what really makes code hard to read is length and indirection). Perfect spacing is not worth spending hours adjusting lines by hand.
If there were an automated tool to achieve consistent formatting, I might hook it up post-check-in. But Style Cop is made by sadists who force the user to do the tedious formatting by hand. Presumably their conversation went like this:
I hate Style Cop. It's below a minimum viable product.