Feature request: code metrics

Hi,

It would be really useful to us if we could have a PL/SQL code metric window embedded in PL/SQL Developer, showing common metrics related to PL/SQL. Being able to specify thresholds and notifying (specific icon or color) when those thresholds are crossed could also be useful.

Furthermore, things inspired from SQLDetective's ClearSQL or TOAD's Code Xpert could also bring a nice complement (code visualization and rules validation).

Thanks!

J
 
You may want to check out the Test Manager (from the Tools menu).

If that's not what you're looking for, then I have no idea what you meant :)
 
The Test Manager is nice, but does not address what I explained above. I'm talking about static code analysis (I don't have to "run" my code) to derive metrics such as:

- lines of code per package
- ratio of comment lines
- ratio of public/private procedures
- cyclomatic complexity
- other metrics relevant to PL/SQL (ratio of DML/SELECTs, JOIN complexity, etc)

We have hundreds of thousands of lines of PL/SQL code and would like to assess the complexity "hot spots"...
 
Jerome,

I knew what you were talking about just from the subject line, having looked into this long ago (way before I encountered Oracle).

For analyzing single pieces of code, this sounds it might be done nicely with a plug-in, or maybe an enhancement to the plsqldoc plug-in. For an across-the-team analysis, I think you'd need a standalone package to generate those statistics and present them in a meaningful way.

I could see this being developed alongside recommendations for Oracle development best practices, but I don't think it's a minor enhancement for PSD itself. For starters, who develops the standards of what the best practices for these metrics would be?

But in the final analysis, I think most developers would rather write code, oblivious to how their code compares to standard measures. :-|

But we should always be looking to improve our skills, right?
 
Thanks for your insights Stew,

If code metrics are presented through a plugin, I'm fine with that, but what do you mean by "across-the-team analysis"? Analysis of the whole project? In that case, I don't see why the plugin couldn't do it (it knows all the packages, procedures and functions). Do you rather mean across the entire development team, as if I wanted to see who's code is the "simplest"? That's not what I'm after, although it would be nice to see trends over time for the entire code base...

Oracle's recommendations are another thing. That would be nice, but that's not our priority.

I'm not in the "just writing code business". I ask for this improvement because it would be useful to us.
 
Jerome,

I'm probably wrong about the "plug-in" concept but all the ones I've worked with have worked on a single object or file at a time. That's why I wasn't thinking about it for analysis of an entire project, much less all projects in a schema.

I wasn't aware (until just now) of Toad's CodeXpert tool, but I could now see something like that as an add-on to PSD. It looks like Quest Software charges about $800 for the version that includes CodeXpert. How much would you pay for such an add-on? :-)

Oracle's recommendations are another thing. That would be nice, but that's not our priority.
What I was trying to say (badly) was that I could see introducing these measure to a project or team as part of establishing "Best Practices", where you give guidelines such as:
  • "a routine should have a cyclomatic complexity of 20 or less", etc.
  • Your ratio of comment lines to code lines should be at least 1-10.
I think just adding a tool to the arsenal without management working with the developers to institute its use is a waste of time and effort.

Just my $.02
 
Stew,

Although a plugin won't be able to analyze the elements of the currently opened project (with the current API at least), it would certainly be able to connect to the DB, find out about my packages/functions/procedures, analyze their code and show the results in a window. But whatever way Allroud Automations finds suitable to implement this, I don't really care... I just ask for the feature.

I agree that Code Xpert is expansive, but it does a lot more than what I'm asking.

I recognize the value of defining "best practices" (that's actually what I meant by "thresholds" in my 1st post). I agree that if management support is not in sync with developer attitude, that won't do much. However, we don't have that problem here.

J
 
Back
Top