Find coding patterns

D

Daniel Schneller

Hi!

I am looking for a way to detect certan patterns in our project's code.
For example I'd like to find all occurences of something like

LOOP
|
+-- CLASS_INSTANCEOF_CERTAINSUPERCLASS.METHODCALL


I. e. I'd like to find out, if and where someone calls methods of
classes of a certain superclass in any kind of loop, because usually
those classes contain only methods that should be called with caution.

Would Checkstyle be suitable? As far as I have seen it concentrates on
syntactic problems, but for the "instanceof" check I'd have to have a
little more of a semantic means of checking.

I'd be happy to hear about any other tool (preferrably with Eclipse
integration) or way to find such things.

Daniel
 
B

bugbear

Daniel said:
Hi!

I am looking for a way to detect certan patterns in our project's code.
For example I'd like to find all occurences of something like

LOOP
|
+-- CLASS_INSTANCEOF_CERTAINSUPERCLASS.METHODCALL


I. e. I'd like to find out, if and where someone calls methods of
classes of a certain superclass in any kind of loop, because usually
those classes contain only methods that should be called with caution.

take a look at findbug, which does something similar and is
extensible/customisable

BugBear
 
A

Andrea Desole

Daniel said:
Thank you!
I will take a look at it. Any other hints/suggestions would still be
highly appreciated :)

Forgot to mention that: I just heard someone talking about PMD, but I
don't know that much about it (don't know that much about FindBugs either):

http://pmd.sourceforge.net/
 
A

Andrew McDonagh

Daniel said:
Hi!

I am looking for a way to detect certan patterns in our project's code.
For example I'd like to find all occurences of something like

LOOP
|
+-- CLASS_INSTANCEOF_CERTAINSUPERCLASS.METHODCALL


I. e. I'd like to find out, if and where someone calls methods of
classes of a certain superclass in any kind of loop, because usually
those classes contain only methods that should be called with caution.

Would Checkstyle be suitable? As far as I have seen it concentrates on
syntactic problems, but for the "instanceof" check I'd have to have a
little more of a semantic means of checking.

I'd be happy to hear about any other tool (preferrably with Eclipse
integration) or way to find such things.

Daniel

Take a look at PMD, there's loads of rules supplied and you can write
your own too.

http://pmd.sourceforge.net/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top