Finding Dead C# Code in an ASP.NET application

Large, long-lasting codebases tend to accumulate unused code, or dead code, over time. This happens as features are added, changed and removed.

Some types of dead code, like unreferenced methods, are easy to detect with Visual Studio’s out-of-the-box static analysis. However, other types of dead code are trickier; maybe there’s a method that’s only referenced by unit tests, or it’s referenced under a condition that’s never valid:

if (DateTime.Now < new DateTime(1970, 1, 1))
    // some dead code

How can we detect this type of dead code? Rather than using static analysis to detect it, we can use dynamic analysis—the same technique continue.

tagged as , and

Increasing Code Quality with SonarQube

I just posted an article about SonarQube, an open source static analysis tool, and how we set it up to scan every incoming GitHub pull request at work.

You can read it at the Jetabroad Tech Blog.

tagged as , and