Web Statistics

Sunday, July 05, 2009

Worst Offenders using NDepend

Here's the basic CQL query I use when beginning to look for areas of code that need some work. The metrics in this query tend to let the worst offenders bubble up to the top. However, I tend to favor ILNestingDepth and CyclomaticComplexity as the two main drivers. As always...this is just the 'smell'...with what's returned from query, the work begins.

Have fun!

// High-Impact candidates for Refactoring
SELECT METHODS WHERE
(
    NbLinesOfCode > 10
    AND
    (
        CyclomaticComplexity > 15 OR
        ILCyclomaticComplexity > 30
    )

    AND

    ILNestingDepth > 5
)
AND
    PercentageComment < 30

AND
(
    !(NameLike "^.ctor")
)
ORDER BY CyclomaticComplexity DESC, NbLinesOfCode DESC

0 comments:

Post a Comment