I am working with multiple enterprise level .NET projects. As a part of Code review tasks, we calculate Code Metrics (Maintainability Index and Cyclomatic Complexity) for these projects using Visual Studio tools.
Now, for Maintainability Index, the acceptable range as suggested by MSDN blogs (that is the Green zone!) is 20-100. But in terms of metrics, that is quite a large range to be in.
I have ever been wondering what should be the ideal value which we should achieve in our code. Some industry experts suggest a range of 40-50. But that is purely a choice, without any specific reason behind.
I came across the below links but they don't suggest any standard.
There is no right answer to this question. There are still quite a few "it depends" issues:
Apart from these, the standard thresholds of Visual Studio are quite liberal. I remember a quote from someone at the Visual Studio team that a too tight setting would mark too much of the average customer's code in orange or red, making people hate the tool, so a slightly more tolerant setting was used. This is why many people with already pretty good codebases tend to use stricter numbers.
The Metrics Codelens add-on or Visual studio 2013 Ultimate shows a better standard score:
Using 60-100 for green.
What is the right setting you ask... well it can be anything between 0 and 100, as that's the range the maintainability index floats between since they re-calibrated it.
Anything above 20 isn't too bad, anything above 60 is pretty good. And you'll certainly have exceptions, where breaking down further doesn't add readability, only obscures the intent of the code. So if you want something better, maybe take to the ones Codelens uses, but don't turn on a blanket rule saying that all code should be at least 80, all developers will hate you for it, and it will not be as productive as you might hope :).