ReSharper's real-time code analysis is super-awesome and has clued me into
a lot of things in the short time I've been using it.
However, out-of-the-box it doesn't bitch at me about zero-code-impact
styling issues, as much as I wish it did. I'm sure everyone has their
bad-style vices.
Some of you have seen StyleCop, which is a great tool for static code
analysis if you want to conform to Microsoft's suggested standards. Some of
which are annoying, but you can enable or disable whatever items you want. You
can also apparently create custom items, though I'm told it's kind of a pain in
the ass... haven't tried to do so yet.
The problem with static code analysis is that it takes a bit of a long time
to run, especially on a large project, and then presents you with a couple
thousand warnings about Everything You've Done Wrong, which will take
you a mountain of time to fix. Don't you wish you could address its warnings as
you write code? I know I do...
I stumbled across this ReSharper StyleCop plugin whilst trolling
StackOverflow, and it's pretty rad.
It's not without its problems obviously, the following of which I've
encountered so far:
- Resharper and StyleCop disagree on some things like usage of this. for private member access, so you just
can't appease them both at the same time without disabling that in one or the
other (see next point)
- There's a bug in the StyleCop settings editor that will quietly fail if you try to change more than one setting at once, which took me forever to realize that it was why my settings weren't persisting
- There's so much stuff to fix in an existing project that you might feel like
a bit of an idiot...
But yeah, great tool for keeping code neat and readable and
standards-compliant! Enjoy!
*Requires ReSharper 4.1 and StyleCop 4.3