priv-kweihmann/multimetric

Overall MI and loc depends on the order of the files

Closed this issue · 2 comments

rcm commented

I was computing the MI over these files:

example.zip

My students complained that their result was not the same as mine.

They were right. I realized that, depending on the order multimetric is called, both the MI and loc are different:
`
$ multimetric parser.c projeto.c stack.c auxParser.c arraysParser.c | grep overall -A 20
"overall": {
"comment_ratio": 38.961312026913376,
"cyclomatic_complexity": 17,
"fanout_external": 5,
"fanout_internal": 3,
"halstead_bugprop": 12.919650911022112,
"halstead_difficulty": 398.4635761589404,
"halstead_effort": 15444030.914192947,
"halstead_timerequired": 858001.7174551637,
"halstead_volume": 38758.95273306633,
"lang": [
"C"
],
"loc": 188,
"maintainability_index": 27.321031561036335,
"operands_sum": 1744,
"operands_uniq": 151,
"operators_sum": 3237,
"operators_uniq": 69,
"pylint": 100.0,
"tiobe": 84.50547945205479,

$ multimetric *.c | grep overall -A 20
"overall": {
"comment_ratio": 38.961312026913376,
"cyclomatic_complexity": 17,
"fanout_external": 5,
"fanout_internal": 3,
"halstead_bugprop": 12.919650911022112,
"halstead_difficulty": 398.4635761589404,
"halstead_effort": 15444030.914192947,
"halstead_timerequired": 858001.7174551637,
"halstead_volume": 38758.95273306633,
"lang": [
"C"
],
"loc": 144,
"maintainability_index": 31.640415905750302,
"operands_sum": 1744,
"operands_uniq": 151,
"operators_sum": 3237,
"operators_uniq": 69,
"pylint": 100.0,
"tiobe": 84.50547945205479,
`

Why is this?
Best regards

Well it seems like that overall section is just reflecting the values (esp. for the very basic stats) for the last seen file (which is wrong). and as the order of your files passed in different (and fairly nondeterministic when using *.c) this leads to the seen indifferent values.
This will take some time to fix, for now all you could do is to ignore the overall section of the output (the individual files are correct AFAIS)

rcm commented

Hmm, I thought you had a way of computing these stats over the entire project.
May I ask what how the overall measures are computed? Especially CC and the other measures used to compute the overall MI?