Skip to content

Instantly share code, notes, and snippets.

Created February 21, 2013 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5003799 to your computer and use it in GitHub Desktop.
Save anonymous/5003799 to your computer and use it in GitHub Desktop.
// <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 &&
context.CompareContext.IsPresentInBothBuilds(m) &&
context.CompareContext.CodeWasChanged(m)
let oldCC = context.CompareContext.OlderVersion(m).CyclomaticComplexity
where oldCC > 6 && m.CyclomaticComplexity > oldCC
select new { m,
oldCC ,
newCC = m.CyclomaticComplexity ,
oldLoc = context.CompareContext.OlderVersion(m).NbLinesOfCode,
newLoc = m.NbLinesOfCode,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment