-
-
Notifications
You must be signed in to change notification settings - Fork 296
Description
Code Complexity:
Using C++ as an example:
"for ",
"for(",
"if ",
"if(",
"switch ",
"switch(",
"while ",
"while(",
"else ",
"|| ",
"&& ",
"!= ",
"== "
The addition of "< ", "> ", "<= ", ">= ", "| ", "& " are all valid logical operators in the C++ language. I can help add these additional operators for languages that I know (Python and C/C++). To me, these logical operators imply the same "complexity" we are trying to track.
The Complexity/Line calculation appears to include blanks and comments in the calculation. I would suspect that code complexity only compare Code vs. Blanks + Comments + Code. This artificially decreases that metric.
Lines and DRYness:
For languages like Java, C, and C++, the utilization of "{" and "}" is common as syntax "sugar" to define portions of code. Currently, a line containing only these constitutes as a Line in the total count. This artificially lowers the DRYness metric by inflating lines of code. I believe there is a strong argument to add an ignore list for lines containing only these symbols. These are counted as not unique when occurring multiple times.
Example:
void foo()
{
}
void bar()
{
}
This counts as 6 lines of code with 4 unique lines for DRYness of 66.66% whereas it could be represented equally as the following:
void foo() {}
void bar() {}
This counts as 2 lines of code with 2 unique lines for DRYness of 100.00%.
In addition, I have noticed the calculation uses all lines (eg. Blanks, Comments, and Code). My expectation would be ULOC to be comprised only of Code and DRYness to also only be Code or Code + Comments.
I know how to add the operators. The ignoring a list of symbols if a line comprises only of those is beyond me (not familiar with Go). Happy to help where I can.