-
During my study of the working of TypeScript and Halstead metrics I found your inspiring work. I wrote a small application to calculate metrics my self. With the help of your Of course I compared the results of our applications and it's a bit odd. The operands are exact the same. But the operators are way off. Given the following code. function test(item) {
if (item <= 3) {
const test = item + 5 * 123;
console.log('hi', test);
} else {
console.error('oops');
}
} I got 15 distinct operators
Your code is returning 3 distinct operators
Obvious I'm doing something wrong. My I found some information (page 4) about Helstead metrics which tells
Please, can you explain to me
Kind regard, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Thanks comment.
PHP is following. https://github.com/ytetsuro/sabik/blob/develop/src/Language/PHP/HalsteadCountableNode.ts#L35-L122 TypeScript is following. https://github.com/ytetsuro/sabik/blob/develop/src/Language/TypeScript/HalsteadCountableNode.ts#L18-L20
Excuse me. The filtering is done below. https://github.com/ytetsuro/sabik/blob/develop/src/Analyzer/FromASTNode/MethodAnalyzer.ts#L16
We believe that it is better to measure only within METHOD based on the following. http://www.virtualmachinery.com/sidebar2.htm
From what I see below, sabik is wrong and needs to be corrected!
|
Beta Was this translation helpful? Give feedback.
Thanks comment.
Sorry for the late reply.
PHP is following.
https://github.com/ytetsuro/sabik/blob/develop/src/Language/PHP/HalsteadCountableNode.ts#L35-L122
TypeScript is following.
https://github.com/ytetsuro/sabik/blob/develop/src/Language/TypeScript/HalsteadCountableNode.ts#L18-L20
https://github.com/ytetsuro/sabik/blob/develop/src/Language/TypeScript/HalsteadCountableNode.ts#L30-L36
Excuse me.
I don't know which Pre-filter you are referring to.
In sabik, we are looking for halstead metrics on a per-method or per-function basis.
So, we ask for halstead metrics using only the code in the method or function.
That is, block…