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:
- JetBrains Resharper
- DevExpress CodeRush & Refactor Pro
- Telerik JustCode
- Visual Assist X
- Typemock Testlint Pro (specifically for unit tests)
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.
- Take for example the performance rule requesting you to make all your methods static. This is actually pointing out to you that you have classes with low cohesion. Just marking everything static might make your code a tiny bit faster, but won't improve your design and will most certainly make testing and maintaining your code harder in the long run.
- Or the rule that mentions you should provide an IFormatProvider to any method that has an overload which supports it. I see too many developers who just put CurrentCulture in there and are done with it. Still getting import/export errors when they transfer files between two differently configured systems. As globalization, localization and internationalization are hard subjects to tackle.
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.