Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
使用 Code Metrics 的方法很簡單,在『方案(solution)』或『專案(project)』按右鍵『Calculate Code Metrics』即可,如下圖:
分析結果顯示在 Code Metrics Results 視窗中:
如上圖所視,這個功能目前計算 5 個指標:Maintainability Index, Cyclomatic Complexity, Depth of Inheritance, Class Coupling, and Lines of Code。這些值的意義稍後會再討論。
在結果視窗的上方,可以使用不同的條件來做篩選。若您的專案很大且複雜,可以透過這篩選來縮小想要看的資訊。另外,也貼心的提供匯出到 Excel 的功能。在每個欄位也提供排序的功能,只要按一下每個欄位的標題即可。
此功能內建在 Visual Studio 2008 Development 及 Team Suite 版本中。