Example of code analysis from StudioShell.Provider

### check-code.ps1 ###

# Run this in the Package Manager Console first – a solution must be open.
#Install-Package StudioShell.Provider

#The following should be run in the Package Manager Console in the form . pathtofilecheck-code.ps1 | out-gridview

#This is a great way of finding code entities where the filename does not match the elements name.

dir dte:/solution/codemodel -recurse | where Kind -Match ‘vs.*(Class|Enum|Interface)’ |select PSPath, Fullname, Name, Kind | % {

$toMatch = “$($_.Name).cs”;
if ($_.PSPath -NotMatch $toMatch) {
return $_
}
}