Use the Visual Studio MACRO(Script) Editor:
I suggest you look at the VS Macros Tool and write a small macro script to parse through the file for you. The main object you will be interested in is one called
Microsoft.VisualStudio.VCCodeModel. This will allow you to use the Visual Studio IDE to parse the code and find all of the function names, then test them with a simple MACRO in the VS IDE:
I can't say this is 100% correct, but it will get you close to what you need:
When you are done, you can map the Macro TestFunctionNameLength to a keyboard command, or run the macro through the Macro Explorer in Visual Studio.
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports VSLangProj2
Imports VSLangProj90
Imports System.Diagnostics
Imports System.Collections.Generic
Imports Microsoft.VisualStudio.VCCodeModel
Imports System.Text
Sub TestFunctionNameLength()
WalkFileCodeElements(AddressOf TestFnNameLenCallBack_)
End Sub
Sub TestFnNameLenCallBack_(ByRef elt As VCCodeElement)
If (elt.Kind() = vsCMElement.vsCMElementFunction) Then
If (elt.Name.Length > 32) Then
End If
End If
End Sub
Public Delegate Sub CodeElementDelegateCallBack(ByRef elt As VCCodeElement)
Sub WalkElementCodeElements(ByVal elts As VCCodeElements, _
ByVal callback As CodeElementDelegateCallBack)
For Each elt As VCCodeElement In elts
callback(elt)
Next
End Sub
Sub WalkFileCodeElements(ByVal callback As CodeElementDelegateCallBack)
Dim vcCm As VCCodeModel
Try
vcCm = DTE.ActiveDocument.ProjectItem.FileCodeModel
Catch ex As Exception
End Try
If (vcCm Is Nothing) Then
Dim dte2 As EnvDTE80.DTE2 = DTE
Dim e As EnvDTE.Properties = dte2.Solution.Properties
Dim project As Project = dte2.Solution.Projects.Item(1)
vcCm = project.CodeModel
If (vcCm Is Nothing) Then
Return
End If
End If
WalkElementCodeElements(vcCm.CodeElements, callback)
End Sub
[Edit: Changed the name of the function call from Sub RemoveFunctionComments(), to TestFunctionNameLength(). This sample was a quick adaptation from a macro I wrote to strip the comments from a function definition.]