Menu

for Matt Munro

Reply to your email did not work with this error:

reason: 550 5.7.1 Access denied

Here is my reply:

you've only added the metric, but not the calculator.
If you add something like this:

<calculator name="Matt Lines" calculatorClass="net.sourceforge.metrics.calculators.LinesOfCodeMatt" level="method">

it should work.

By the way, I would write a separate plugin to do this instead of
modifying the core metrics plugin. I should have split off the calculators
in a separate plugin myself to make this more clear. In this new plugin you
do this:

<extension id="mattmetrics" name="Core Metrics" point="net.sourceforge.metrics.metrics">
<metric name="Code Matt" level="method" id="MATT">
<range max="50" hint="use Extract-method to split the method up"/>
</metric>
<calculator name="Matt Lines" calculatorClass="net.sourceforge.metrics.calculators.LinesOfCodeMatt" level="method"/>
</extension>

and of course add your code and change the reference to the calculator class
in your plugin.xml and it should work. You don't have to use the Constants.java
at all, simply call the superclass constructor with "Matt" or write your own
Constants.java. That was just a convenience for internal use, not meant for external
(re)use. I was sloppy in my API conventions, sorry.

Hope this helps,

Frank

-----Original Message-----
From: Matt Munro [mailto:]
Sent: Thursday, August 21, 2003 3:13 PM
To: sauerf@users.sourceforge.net;
Subject: metric developement

Dear Frank,

I am writing with interest regarding the Eclipse plugin metric framework. I would like to use the framework to implement and develop my own metrics. I have turned to you for some help with understanding and using the framework.

First of all I have managed to download the most up to date package from the CVS repository. The documentation that came with this package mentions how to insert a new metric, through making the appropriate changes in the plugin.xml file.

To start with I have set a small goal to implement a metric that is very similar to an exiting metric in the framework. My plan is to increase LOC by 10, and I have renamed the metric as MATT.

From my understanding of the framework I have made additional changes to Constants.java and created a new file LinesOfCOdeMatt.java, to achieve this goal.

However when I run the plugin through the run-time workbench in eclipse, my new metric does not show up in the metric table. However if I change the plugin.xml file at the point where the MATT metric is defined to have have an id="LOC", it does show up in the metric table at run-time with the same values as LOC.

My frustration is how can I allow the framework learn about new metrics?

I hope you can help and identify where I am going wrong with the first stages of development.

Many Regards
Matt

ps -> I have attached the files which I altered in the framework as to save describing where the small changes were made.

Posted by Frank Sauer 2003-08-22

Log in to post a comment.