Visual Studio Code Metrics & Refactoring
“Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior.” Martin Fowler
Using Code Metrics feature of Visual Studio (or Code Metrics Power Tools if you don’t have Premium or Ultimate edition) you can get some good information about which unit of code or components are candidates for refactoring.
Use this tool regularly in order to track refactoring opportunities. Check this MSDN article and this Post for usage.
Some metric hints you could use:
- Maintainability Index (< 40 or instance)
- Cyclomatic Complexity (> 15)
- Make a Top Ten Ranking of Refactoring Candidates by using: [Cyclomatic Complexity] * [LOC (Line of Code)] => Order By Desc
For valid ranges, check this Post.
PS: I will be working on how to get this metrics into a TFS Team Project Report.