C# LINQ code queriesと書くと、必要なコードメトリックを得ることができます。識別子
from t in Application.Types
select new { t, t.SimpleName.Length }
/ファンにおけるファンアウト(this definitionに従って)クラスオブジェクトのクラス
from t in Application.Types
select new { t, t.CyclomaticComplexity }
結合
の
from t in Application.Types
select new { t, t.TypesUsed, t.TypesUsingMe }
重み付け方法の
長0
from n in Application.Namespaces
let NumberOfClasses = n.ChildTypes.Count()
let NumberOfLinks = n.ChildTypes.SelectMany(t => t.TypesUsed).Distinct().Count()
select new { n, CBO = NumberOfLinks/(float)NumberOfClasses }
コードクエリをプレフィックスwarnif count > 0
を持つコードルールに変換し、そのルールをVisual Studioおよび/またはBuildProcessで実行するように保存できます。
// <Name>Type name shouldn't exceed 25 char</Name>
warnif count > 0
from t in Application.Types
where t.SimpleName.Length > 25
orderby t.SimpleName.Length descending
select new { t, t.SimpleName.Length }
![enter image description here](https://i.stack.imgur.com/Wy8pV.png)
しかし、私はまだあなたがこの質問を見てとることができ、NDependのを模索しています。http://stackoverflow.com/questions/37083906/how-to-use-cqlinq-to-を単一のクエリ内のメトリック・オブ・メソッドとフィールドを取得することは同じことですが、私は別の質問でそれをよりうまく議論する必要があると思います。 – VincentZHANG
さらに、メソッドのための複雑な循環アルゴリズムのアルゴリズムは何ですか?ここで説明するのと同じですか:http://staff.unak.is/andy/StaticAnalysis0809/metrics/cyclomatic_complexity.html?私は矛盾を発見した。 – VincentZHANG
NDepend CCの詳細はこちらをご覧ください:http://www.ndepend.com/docs/code-metrics#CC –