By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,159 Members | 1,941 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,159 IT Pros & Developers. It's quick & easy.

Looking for simple code analysis tool

P: n/a
Hello all,

I'm looking for a very simple code analysis tool. I have a large
codebase to analyze, and all I really need to do is to find all uses
of all methods in a few interfaces.

Many tools (e.g. Resharper) obviously do this internally, but I can't
seem to find any that expose this simple functionality. Command line
would be fine -- in fact I'd prefer that but its not necessary.

Does anyone have any suggestion?

Thanks much,
b. taxi

Nov 13 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On 2007-11-12 18:31:05 -0800, be******@gmail.com said:
Hello all,

I'm looking for a very simple code analysis tool. I have a large
codebase to analyze, and all I really need to do is to find all uses
of all methods in a few interfaces.

Many tools (e.g. Resharper) obviously do this internally, but I can't
seem to find any that expose this simple functionality. Command line
would be fine -- in fact I'd prefer that but its not necessary.

Does anyone have any suggestion?
Maybe you could be more clear about your question. As stated, it's
difficult to understand why the "findstr" NT command prompt command or
some grep implementation (including the "find in files" feature in
Visual Studio) wouldn't accomplish what you're asking for.

Pete

Nov 13 '07 #2

P: n/a
Fair question. Short answer: because findstr and grep (or Find in
Files) won't work :)

Simple example: I have interface IFoo with method GetName(). I want to
find all invocations of IFoos GetName() method, on all
implementations. If if I grep on GetName() I'll get all calls to *any*
GetName() method, and in a large codebase I might have many methods
called GetName().

The functionality I want is exactly what's provided by Resharper's
"Find Usages" command, except that command is only available from the
IDE, one method at a time. I need something that can give me all the
usages on all methods on whatever interfacea or classes I specify.
This functionality obviously exists under the hood of any number of
code analysis tools, so I assume it exists somewhere in the simple
form I need, rather than an cyclometric analysis report generator.

Thanks,
Chris

On Nov 12, 10:06 pm, Peter Duniho <NpOeStPe...@NnOwSlPiAnMk.com>
wrote:
On 2007-11-12 18:31:05 -0800, beant...@gmail.com said:
Hello all,
I'm looking for a very simple code analysis tool. I have a large
codebase to analyze, and all I really need to do is to find all uses
of all methods in a few interfaces.
Many tools (e.g. Resharper) obviously do this internally, but I can't
seem to find any that expose this simple functionality. Command line
would be fine -- in fact I'd prefer that but its not necessary.
Does anyone have any suggestion?

Maybe you could be more clear about your question. As stated, it's
difficult to understand why the "findstr" NT command prompt command or
some grep implementation (including the "find in files" feature in
Visual Studio) wouldn't accomplish what you're asking for.

Pete

Nov 13 '07 #3

P: n/a
Put all the code into a Visual Studio Solution and use Find All References
for each method you're interested in. The Find Symbol output window will
list file and line where the reference is.
<be******@gmail.comwrote in message
news:11**********************@o38g2000hse.googlegr oups.com...
Hello all,

I'm looking for a very simple code analysis tool. I have a large
codebase to analyze, and all I really need to do is to find all uses
of all methods in a few interfaces.

Nov 13 '07 #4

P: n/a
Sorry if I'm not being clear . . . I'm not just looking for something
I can do in a GUI, one method at a time. I can do that now. I'm
looking for something that can operate over a number of interfaces. To
give you an example, some of these interfaces have over 100 methods.
Yep, that's wayyyyyyy too many, which is why I'm doing the analysis in
the first place, so I can find out which methods are used and which I
can kill. Oh, I can't just delete all methods, build, and see what
breaks, because we have dozens of solutions which may be using the
interface.

Thanks,
b. taxi

On Nov 13, 9:25 am, "bryan" <bryandonald...@mindspring.comwrote:
Put all the code into a Visual Studio Solution and use Find All References
for each method you're interested in. The Find Symbol output window will
list file and line where the reference is.

<beant...@gmail.comwrote in message

news:11**********************@o38g2000hse.googlegr oups.com...
Hello all,
I'm looking for a very simple code analysis tool. I have a large
codebase to analyze, and all I really need to do is to find all uses
of all methods in a few interfaces.

Nov 13 '07 #5

P: n/a
On 2007-11-13 08:45:33 -0800, ch*********@gmail.com said:
Sorry if I'm not being clear . . . I'm not just looking for something
I can do in a GUI, one method at a time. I can do that now. I'm
looking for something that can operate over a number of interfaces.
For what it's worth, your follow-up to my post did clarify things.

Unfortunately, I'm not aware of a tool that does this. However, that's
not to say one doesn't exist. I think it's possible that one or more
of the third-party tools that are often mentioned in this newsgroup may
do what you're looking for. The Resharper tool comes to mind, for
example. Maybe even Reflector.

Barring that, it might not be hard to implement yourself. Again,
lacking first-hand experience I can't offer much advice. But I know
from discussions with other C# coders that you can write a C# program
that compiles code, and I know that you can write a C# program that
uses reflection to inspect that code.

So it seems to me that you could write a program that, given a target
directory, enumerates the .cs files or projects in the directory
(optionally enumerating directories within directories, of course),
compiles what it finds, and then inspects the compiled results looking
for the desired interface methods.

Pete

Nov 13 '07 #6

P: n/a
Hmmm . . . this sounds promising. I was figuring I might have to write
it myself, but I hadn't thought of using any compilation tools to help
out. That's definitely interesting.

Thanks Peter,
b. taxi

On Nov 13, 12:22 pm, Peter Duniho <NpOeStPe...@NnOwSlPiAnMk.com>
wrote:
On 2007-11-13 08:45:33 -0800, chris.la...@gmail.com said:
Sorry if I'm not being clear . . . I'm not just looking for something
I can do in a GUI, one method at a time. I can do that now. I'm
looking for something that can operate over a number of interfaces.

For what it's worth, your follow-up to my post did clarify things.

Unfortunately, I'm not aware of a tool that does this. However, that's
not to say one doesn't exist. I think it's possible that one or more
of the third-party tools that are often mentioned in this newsgroup may
do what you're looking for. The Resharper tool comes to mind, for
example. Maybe even Reflector.

Barring that, it might not be hard to implement yourself. Again,
lacking first-hand experience I can't offer much advice. But I know
from discussions with other C# coders that you can write a C# program
that compiles code, and I know that you can write a C# program that
uses reflection to inspect that code.

So it seems to me that you could write a program that, given a target
directory, enumerates the .cs files or projects in the directory
(optionally enumerating directories within directories, of course),
compiles what it finds, and then inspects the compiled results looking
for the desired interface methods.

Pete
Nov 15 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.