1
嘗試使用自定義NDepend變量來代替常量,並且無法找出圍繞let
關鍵字的NDepend語法的一些複雜性。NDpend變量計算
一個內置的查詢是:
warnif count > 0 from m in JustMyCode.Methods where
m.CyclomaticComplexity > 30 ||
m.ILCyclomaticComplexity > 60 ||
m.ILNestingDepth > 6
orderby m.CyclomaticComplexity descending,
m.ILCyclomaticComplexity descending,
m.ILNestingDepth descending
select new { m, m.CyclomaticComplexity,
m.ILCyclomaticComplexity,
m.ILNestingDepth }
而我真正想要做的是不要使用0恆定值和底座上的代碼庫來代替。沿線的東西:
let tenPercent = (JustMyCode.Methods.Count()/100 * 10)
warnif count > tenPercent from m in JustMyCode.Methods where
m.CyclomaticComplexity > 30 ||
...
這是可能的嗎?