473,406 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Looking for simple code analysis tool

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
6 2304
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jens Nordahl | last post by:
On a large scale C++ project we are considering to make a static code analysis tool capable of giving answers to high level questions like (examples): - Which entry points on this layer in the...
1
by: hico74 | last post by:
Hi all. I'm looking for a tool which should act like some kind of middleware/ logical layer bewtween the SQL server and the webbased user interface. - It should be possible to easily create...
6
by: rahul8143 | last post by:
hello, Is there any source code analysis tool avail for C programmers under Linux? That tool should go through all source code files and print functional dependencies. tool can run in any...
4
by: Richard MSL | last post by:
I have a simple application in C++ that uses a dll I wrote in C#. It works fine when I run it on C: on my local PC, but when I attempt to run it on the i: drive on my LAN, it gets a loading...
3
by: moondaddy | last post by:
I'm looking for a thesaurus tool I can use in an application. I was hoping it could be a web service where my app could submit a work and get a list of results back which my code could use. any...
5
by: Sam Carleton | last post by:
I am now many months into a project where the powers that be decided to simply throw static strings in the .Net code. Does anyone know of a tool that will pull out the strings, and put them into...
176
by: nw | last post by:
Hi, I previously asked for suggestions on teaching testing in C++. Based on some of the replies I received I decided that best way to proceed would be to teach the students how they might write...
2
by: Bob Altman | last post by:
Hi all, A friend of mine is an experienced MFC programmer. He as recently gotten ".Net Religion", but he can't find a good reference book that presents basic Windows Forms programming...
12
by: Stewart Berman | last post by:
Where is the equivalent of the Windows.h (and it's includes) for C#?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.