When the output is generated with -wide the Complexity/Lines is calculated. This is okay for one or multiple files. But then the Complexity/Lines is accumulated to sum up to the language Complexity/Lines. But this is not correct.
The error is also produced when run without --by-file
Expected behavior
The Complexity/Lines should not be added from each file to produce the language-Complexity/Lines. Instead, it should be calculated on the summed up language Complexity and Lines. In the above example, the correct Complexity/Lines for C Header would be:
Alternatively: if the described output is by design, the headline Complexity/Lines is wrong for the language and total results. But I could not find any description on the reason why the sum of the file Complexity/Lines is equivalent to the language or total Complexity/Lines.
One more thing: It would be nice to have the option to sort the files by Complexity/Lines. Current options are:
-s, --sort string column to sort by [files, name, lines, blanks, code, comments, complexity] (default "files")
Describe the bug
When the output is generated with
-wide
theComplexity/Lines
is calculated. This is okay for one or multiple files. But then theComplexity/Lines
is accumulated to sum up to the languageComplexity/Lines
. But this is not correct.Example:
The language result seems to be calculated like this:
$$ 4.17\,{Complexity \over Lines} + 17.46 \,{Complexity \over Lines} + 23.08\,{Complexity \over Lines} = 44.70\,{Complexity \over Lines} $$
The problem even extends to the total calculation:
To Reproduce
scc.exe --no-cocomo --no-size --sort complexity --wide header_file_1.h header_file_2.h header_file_3.h
The error is also produced when run without
--by-file
Expected behavior
The
Complexity/Lines
should not be added from each file to produce the language-Complexity/Lines
. Instead, it should be calculated on the summed up language Complexity and Lines. In the above example, the correctComplexity/Lines
for C Header would be:$$ {27 \,Complexity \over 338 \,(Code)Lines} = 7.99 \,{Complexity \over Lines} $$
And for the total result:
$$ {2594 \,Complexity \over 10816 \,Lines} = 23.98 \,{Complexity \over Lines} $$
Alternatively: if the described output is by design, the headline
Complexity/Lines
is wrong for the language and total results. But I could not find any description on the reason why the sum of the fileComplexity/Lines
is equivalent to the language or totalComplexity/Lines
.One more thing: It would be nice to have the option to sort the files by
Complexity/Lines
. Current options are:Desktop: