尝试使用自定义NDepend变量代替常量,并且无法解决围绕let
关键字的NDepend语法的一些复杂问题。
其中一个内置查询是:
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 ||
...
这甚至可能吗?