We have a huge code base, where methods with too many local variables alone returns 226 methods. I don't want this huge table being dumped into the xml output to clutter it up, and I'd like the top 10 if possible, but what I really want is the count so we can do trending and executive summaries. Is there a clean/efficient/scalable non-hacky way to do this?
I imagine I could use an executable task, instead of the ndepend task (so that the merge is not automatic) and the clutter doesn't get merged. Then manually operate on those files to get a summary, but I'd like to know if there is a shorter path?
What about defining a base line to only take account of new flaws?
what I really want is the count so we can do trending and executive summaries
Trending can be easily achieved with code queries and rules over LINQ (CQLinq) like: Avoid making complex methods even more complex (Source 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,
}