Chapter 20Code Analysis, Code Metrics, Code Clone Analysis, and CodeLens

What's in this chapter?

  • Enabling and running code analysis in Visual Studio 2013
  • Correcting code analysis rule violations
  • Understanding code metrics and how to use them
  • Using Code Clone Analysis to find similar code fragments in the code base
  • Using CodeLens to better understand the code base

Wrox.com Code Downloads for this Chapter

The wrox.com code downloads for this chapter are found at www.wrox.com/go/proalm3ed on the Download Code tab. The files are in the Chapter 20 download folder and individually named as shown throughout this chapter.

This chapter describes the code analysis, code metrics, code clone analysis, and CodeLens features included with the Visual Studio 2013. Code analysis is available in Visual Studio 2013 Professional and higher SKUs. Code metrics and code clone analysis are available in Visual Studio 2013 Premium and higher SKUs. And CodeLens is available in Visual Studio 2013 Ultimate. These tools can quickly and easily inspect your code to find common mistakes, make suggestions for improvements, and even indicate violations of standards.

The discussion begins by examining the origins of the Code Analysis tool. You find out about Microsoft's .NET “Design Guidelines for Class Library Developers” and how it is related to the tools. You also take a brief look at what is new with these tools in Visual Studio 2013.

Then you explore the code analysis a bit and learn how to take advantage ...

Get Professional Application Lifecycle Management with Visual Studio 2013 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.