For VS2022 release, see this version on marketplace: https://marketplace.visualstudio.com/items?itemName=ognjen-babic.CodeMaintainability2022 IntroductionExtension for tracking code maintainability of your methods, integrated into CodeLens. Instead of often performing report driven code analysis tools, you can use this extension to view in real-time maintainability score. This score is calculated only based on syntax parsing and has no logical implications, thus results should not be followed strictly. Instead, you should use this extension as a guide for discovering potential problems in your code. By default, Maintainability score is tracked and it ranges from 0 -100. Lower score means the method is harder to maintain. Calculations are done based on the formula found on the MSDN blog here. Based on the score value we can distinguish three categories (threshold limits for each category can be adjusted in options):
You can also change main metric to track in options. Other available metrics are:
Metric calculation is triggered on document save. UsageAfter installing extension you can view maintainability score next to the method declaration: Clicking on the CodeLens score will provide you more info about additional metrics used in computing maintainability index: OptionsIn the Visual Studio options menu you can find a new entry called Code Maintainability. Here you can select default metric to track, if status icon should be displayed in CodeLens and in Details pane. Also, you can adjust threshold limits for each metric (status icon will change colors based on value and range set) and if metric should be visible at all in details pane. ContactIf you have any feedback or requests, please contact me here or via email: babicognjen.oggy@hotmail.com. |