Heuristic to find types moved from one namespace or assembly to another

Code Query Code Diff Summary

Runs only in diff mode (baseline defined). Lists types moved between namespaces or assemblies, via a join LINQ query on type name (without namespace prefix) over the types added and removed sets.

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>Heuristic to find types moved from one namespace or assembly to another</Name>
let typesRemoved = codeBase.OlderVersion().Application.Types.Where(t => t.WasRemoved())
let typesAdded = Application.Types.Where(t => t.WasAdded())

from tMoved in typesAdded.Join(
   typesRemoved,
   t => t.Name,
   t => t.Name,
   (tNewer, tOlder) => new { tNewer, 
                             OlderParentNamespace = tOlder.ParentNamespace,
                             OlderParentAssembly = tOlder.ParentAssembly  } ) 
select tMoved

//<Desc>
// Runs only in *diff mode* (baseline defined). Lists *types* moved between
// namespaces or assemblies, via a **join LINQ query** on type name (without
// namespace prefix) over the types *added* and *removed* sets.
//</Desc>

Code Diff Summary: all 25 items