NDepend数、平均等。报告...聚集。可能吗?清洁工作变通?
-
26-09-2019 - |
题
我们有一个庞大的代码的基础,其方法太多地方的变量的单独返回226方法。我不想要这个巨大的表正在被倾倒入xml输出来混乱,并且我希望的前10如果可能的话,但我真正想要的是该计数,以便我们可以做的趋势和执行摘要。是有一个干净的/有效/可扩展的非哈克的方式做到这一点?
我想我可以用一个可执行的任务,而不是ndepend任务(因此,合并不是自动的)和杂乱没有得到合并。然后手动操作上的这些文件获得一个总结,但我想知道,如果有一个更短的路径?
解决方案
怎么样 界定一个基线,只考虑新的缺陷?
我真正想要的是该计数,以便我们可以做的趋势和执行摘要
趋势分析可以很容易地实现码查询和规则在皇宫(CQLinq),如: 避免复杂的方法甚至更为复杂的形势(资料来源CC)
// <Name>Avoid making complex methods even more complex (Source CC)</Name>
// To visualize changes in code, right-click a matched method and select:
// - Compare older and newer versions of source file
// - Compare older and newer versions disassembled with Reflector
warnif count > 0
from m in JustMyCode.Methods where
!m.IsAbstract &&
m.IsPresentInBothBuilds() &&
m.CodeWasChanged()
let oldCC = m.OlderVersion().CyclomaticComplexity
where oldCC > 6 && m.CyclomaticComplexity > oldCC
select new { m,
oldCC ,
newCC = m.CyclomaticComplexity ,
oldLoc = m.OlderVersion().NbLinesOfCode,
newLoc = m.NbLinesOfCode,
}
不隶属于 StackOverflow