Can StyleCop automatically fix anything?

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.

Of course, if there were an automated tool to achieve consistent formatting, I'd hook it up post-check-in, and let it help me. But Style Cop is made by sadists. Presumably their conversation went like this:

Bob: Using pattern matching, the software identifies ugly code
Charlie: —and fixes it!
Bob: No, it prints a message about each transgression
Charlie: —and then the user right-clicks to fix them all?
Bob: No, it scolds them 'invalid spacing around the comma'
Charlie: —and then explains how to fix it?
Bob: No, that's in a separate document
Charlie: —on Google?
Bob: No.

I hate Style Cop. It's below a minimum viable product.


Nowadays you can use the StyleCop.Analyzers NuGet package in your projects.

NuGet Package Manager available StyleCop.Analyzers update

Updating the package can result in a lot of new warnings.

Visual Studio Error List warnings of 'Documentation text should end with a period'

Ctrl + . shows available quick fixes. A fix can be applied to the whole document, project or solution at once.

Visual Studio quick fix. Marked 'Fix all occurrences in' options

A Preview Changes window lets you deselect the lines to resolve manually.

Window Preview Changes - Fix all occurrences

CodeMaid is a good tool to fix formatting errors in batch or automatically.