0

I have a situation which demands the following code metrics.

Maintainability index > 80 & Cyclomatic complexity < 20

But as per MSDN (http://msdn.microsoft.com/en-us/library/cc667398(v=VS.90).aspx).

  • Maintainability index > 20 is green
  • Cyclomatic complexity < 25 is good.

I need to understand the following:

  1. Is it worth investing time to improve maintainability Index from 20 to 80?
  2. If we don't achieve a maintainability index > 80, will there be an increase in maintenance cost?
  3. What is the impact of keeping Cyclomatic complexity < 25?

Thanks in advance.

4

2 に答える 2

0

状況がそれを「要求する」場合、(1) に対する答えは「はい」です。

(2)の答えはさまざまです。一般に、保守性指数が高いほど保守コストは低くなりますが、保守が困難であると予測されるコードは完全に機能し、保守がまったく必要ない場合があります。また、メンテナンスが提案されたとしても、それを維持するためにいくら費やすかを決定するのはメンテナー次第です。

(3) に関しては、20 と 25 の循環的複雑度の間に大きな違いはありません。両方とも、私が通常見た推奨数よりも高くなっています。数値が大きいほど条件が多いことを示し、条件が多いほど、コードが何を行っているのか、何を変更する必要があるのか​​を把握するのが難しくなります。

于 2019-03-26T22:30:13.020 に答える