Methods indirectly calling one or several methods changed

Code Query Code Diff Summary

Runs only in diff mode (baseline defined). Lists unchanged methods using directly or indirectly methods whose code changed since the baseline: their code didn't change but their behavior might have. The result includes the changed methods directly used and the depth of usage, as defined for the DepthOfIsUsingAny() NDepend API method: https://www.ndepend.com/api/NDepend.CodeModel.ExtensionMethodsSequenceUsage.html#NDepend_CodeModel_ExtensionMethodsSequenceUsage_DepthOfIsUsingAny__2_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEnumerable___1__

CQLinq source

This code query is written in CQLinq, C# LINQ over the NDepend code model. It ships with every new NDepend project: you can read it, adapt it, or use it as a starting point for your own custom rules.

// <Name>Methods indirectly calling one or several methods changed</Name>
let methodsChanged = Application.Methods.Where(m => m.CodeWasChanged()).ToHashSetEx()

// 'depth' represents a code metric defined on methods using
// directly or indirectly any method where code was changed.
let depth = JustMyCode.Methods.DepthOfIsUsingAny(methodsChanged) 

from m in depth.DefinitionDomain where
  !m.CodeWasChanged() && 
  !m.WasAdded()

let methodsChangedDirectlyUsed = m.MethodsCalled.Intersect(methodsChanged) 
let depthOfUsingMethodsChanged = depth[m]
orderby depthOfUsingMethodsChanged 

select new { 
   m, 
   depthOfUsingMethodsChanged, 
   methodsChangedDirectlyUsed 
}

//<Desc>
// Runs only in *diff mode* (baseline defined). Lists *unchanged* methods
// **using directly or indirectly** *methods* whose code changed since the
// *baseline*: their code didn't change but their behavior might have. The
// result includes the changed methods directly used and the **depth of
// usage**, as defined for the *DepthOfIsUsingAny()* NDepend API method:
// https://www.ndepend.com/api/NDepend.CodeModel.ExtensionMethodsSequenceUsage.html#NDepend_CodeModel_ExtensionMethodsSequenceUsage_DepthOfIsUsingAny__2_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEnumerable___1__
//</Desc>

Code Diff Summary: all 25 items