Code complexity - Indentation Heuristic
Problem to solve
After we identify code hotspots, we would like to understand how complex the code is there since we might have perfectly good code that just needs to be broken down. A simple metric that correlates with McCabe Cyclomatic Complexity and Halstead complexity measures is indentation.
- Use indentation in a file, i.e. count the tabs (or 4 spaces as one unit) on each line, ignoring empty lines/ comment lines
- Get statistics such as the min, average, variance and max in a file
- Change in indentation between revisions of the file, i.e. the trend I would suggest for the information to be reflected in a line chart, next to the code hotspots in Code Analytics, since we would like to see trends.
I would suggest a charts: On the x-axis, we can have the day the commits to master happened, while on the y-axis the mean amount of namespaces with 1 std deviation, sort of like Bollinger bands.
High std deviation means that there are portions of the code that probably should be reviewed.
We would like to connect the trends to what we see in terms of what people are working on - if we are seeing a lot of refactoring, we expect the complexity to go down with time - @valexieva to decide how to do this.
The calc should be done on master.