It’s time for another post in the CodeIt.Right Rules Explained series. If this is the first such post you’ve seen, I’ll explain briefly how it works. CodeIt.Right is an automated code review tool for .NET, and it has a bunch of rules. In these posts, I explain those rules in detail.
Whenever I post in this series, I start with my two rules of thumb for static analysis.
- Never implement a suggested fix without knowing what makes it a fix.
- Never ignore a suggested fix without understanding what makes it a fix.
As always, I’ll explain that I don’t phrase it this way to be cute. You could reduce this logically to “figure out why the tool is suggesting this.” But I specifically opt not to.
The reason is that each time the tool confronts you with a warning, you have a choice: address the warning or ignore it. And in either case, you should make that choice for the right reasons. Are you ignoring it because you’ve determined that the pros of having it outweigh the cons the tool is warning you about? Or are you ignoring it because you don’t feel like dealing with it? The same thing applies, too, on the side of implementing fixes.
So, that said, let’s dive into three more rules today.