Various JSMeter observations/bugs

28 views
Skip to first unread message

trf

unread,
Sep 6, 2010, 5:10:51 PM9/6/10
to jsmeter-discuss
Hi

I've continued to look at jsmeter and hook it into a rhino based
reporting script run via Ant.
I have however come up against a few issues with the complexity
algorithm that possibly deserve some modification. Thoughts welcome.

1. If I process a file containing only function definitions (eg like a
library or include file), the top level complexity will currently
choke, because the sigDig function does not deal with NaN.
Therefore I amended it to be -
sigDig = function(value, sd) {
if (value===NaN) {
return null;
}
... continue as before

2. You get a NaN for the MI stat if CC > 0 but Program Level = 0 I
believe, again due to the reason above.
What should the best approach be - I'd think there's some way to know
that no true statement exist at file scope and somehow suppress the
metric ?

3. I externalised renderStats out of complexity.js since it expects
DOM objects at runtime. For running under Rhino I simply define a new
renderStats function injected at runtime which generates a JSON format
result

4. I get a most wierd error when parsing some of my server side JS
code. I get -
Problems parsing this file. 61, Expected a new variable name., error

60 var pstn = userDataStat.getNVPValue("PSTN");
61 var error = userDataStat.getNVPValue("Error");
I can't figure out what the issue is with basically a simple variable
declaration/assignment?

cheers


Tim

Noah Peters

unread,
Sep 6, 2010, 7:37:36 PM9/6/10
to jsmeter-discuss
Tim, thanks for the input. I agree with you on part one and have
included a checks for NaN throughout the function, and that also takes
care of MI (point 2).

On point 3, DOM dependency, I agree and had previously removed the
dependency as well as added the JSON object output. It can either
provide output as an HTML table string, or as JSON.

Since it looks like you weren't using the latest code base, can you
try/verify that you are still receiving the error you found in point
4? I have added some additional "forgiveness" into the code.

-noah
Reply all
Reply to author
Forward
0 new messages