microsoft / NeuronBlocks
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 601 units with 6,522 lines of code in units (81.2% of code).
    • 5 very long units (888 lines of code)
    • 13 long units (928 lines of code)
    • 43 medium size units (1,317 lines of code)
    • 90 small units (1,369 lines of code)
    • 450 very small units (2,020 lines of code)
13% | 14% | 20% | 20% | 30%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py13% | 14% | 20% | 20% | 30%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT32% | 31% | 16% | 9% | 9%
utils24% | 0% | 19% | 18% | 36%
model_visualizer0% | 93% | 0% | 0% | 6%
block_zoo0% | 0% | 18% | 27% | 54%
metrics0% | 0% | 55% | 32% | 12%
core0% | 0% | 18% | 26% | 54%
dataset0% | 0% | 60% | 21% | 18%
tools0% | 0% | 27% | 64% | 8%
losses0% | 0% | 18% | 67% | 13%
autotest0% | 0% | 0% | 75% | 25%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def evaluate()
in LearningMachine.py
221 30 14
def train()
in LearningMachine.py
214 41 3
212 11 13
def get_batches()
in utils/corpus_utils.py
137 1 10
def predict()
in LearningMachine.py
104 38 5
def json2graph()
in model_visualizer/get_model_graph.py
99 20 2
def json2graph()
in model_visualizer/server/mv.py
96 20 1
def interactive()
in LearningMachine.py
86 31 5
86 56 1
def main()
in train.py
78 25 1
def build()
in problem.py
72 21 17
def check_conf()
in ModelConf.py
67 45 1
def __init__()
in Model.py
65 27 5
def get_conf()
in Model.py
64 5 13
def decode()
in problem.py
59 19 4
53 22 6
def main()
in predict.py
52 15 1
def __init__()
in LearningMachine.py
51 4 8
def countChunks()
in metrics/conlleval.py
49 23 4
def __init__()
in problem.py
49 14 12