You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is appreciated that one of Halstead's weaknesses is a lack of agreement on what is and isn't an operator. However, the stats look very kind at the moment, suggesting operators are being missed. It would be good to a have a declaration of operators that are recognised on the docs page.
It seems at the moment detected operators (you are welcome to correct me if I'm wrong) are:
Binary Operator
Boolean Operator
Unary Operators (such as ones complement, not, lone minus sign)
Comparison Operators
Augmented assign (e.g. a+=1)
And these are not recognised:
Assignment
Function/Method calls
Conversions such as str, dict, list, bytes, ...
If statements - whilst comparisons are, in the case if var: var would be ignore as an operand, and if does not count as an operator
List and Set Comprehensions are completely ignored
IMHO these should all impact the Halstead calculations - but I'm guessing its difficult to get the info from the "ast" module?
The text was updated successfully, but these errors were encountered:
I agree that most of these should be recognized. Halstead even refers to the "assignment operator" a few times in The Elements of Software Science, using it to compute some ideal metrics like potential volume.
Some of these seem simple to add. A quick glance at the ast docs shows that assignment, functional call, and conditional nodes are all there. Type conversions parse as functions under the hood, so those would be included. List comprehensions are also there, and could probably be handled recursively.
It is appreciated that one of Halstead's weaknesses is a lack of agreement on what is and isn't an operator. However, the stats look very kind at the moment, suggesting operators are being missed. It would be good to a have a declaration of operators that are recognised on the docs page.
It seems at the moment detected operators (you are welcome to correct me if I'm wrong) are:
And these are not recognised:
if var:
var would be ignore as an operand, and if does not count as an operatorIMHO these should all impact the Halstead calculations - but I'm guessing its difficult to get the info from the "ast" module?
The text was updated successfully, but these errors were encountered: