pytorch / tnt
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 136 units with 1,221 lines of code in units (82.4% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (61 lines of code)
    • 13 medium size units (384 lines of code)
    • 22 small units (315 lines of code)
    • 100 very small units (461 lines of code)
0% | 4% | 31% | 25% | 37%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 4% | 31% | 25% | 37%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
example0% | 30% | 38% | 16% | 14%
torchnet/meter0% | 0% | 47% | 10% | 42%
torchnet/logger0% | 0% | 24% | 41% | 34%
torchnet/engine0% | 0% | 90% | 0% | 9%
torchnet/dataset0% | 0% | 11% | 30% | 57%
torchnet/utils0% | 0% | 0% | 50% | 49%
torchnet0% | 0% | 0% | 44% | 55%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in example/mnist_with_visdom.py
61 2 0
def add()
in torchnet/meter/apmeter.py
46 14 4
def main()
in example/mnist.py
40 2 0
def main()
in example/mnist_with_meterlogger.py
39 2 0
def train()
in torchnet/engine/engine.py
33 3 5
def add()
in torchnet/meter/confusionmeter.py
30 7 3
def value()
in torchnet/meter/apmeter.py
27 8 1
def log()
in torchnet/logger/visdomlogger.py
26 6 3
def __init__()
in torchnet/dataset/splitdataset.py
25 8 4
def value()
in torchnet/meter/aucmeter.py
25 4 1
def print_meter()
in torchnet/logger/meterlogger.py
24 7 6
def add()
in torchnet/meter/classerrormeter.py
24 7 3
def __addlogger()
in torchnet/logger/meterlogger.py
23 4 3
def test()
in torchnet/engine/engine.py
22 2 3
def __init__()
in torchnet/logger/visdomlogger.py
20 2 9
def _log_all()
in torchnet/logger/visdomlogger.py
20 7 6
def update()
in torchnet/utils/resultswriter.py
20 2 3
def __init__()
in torchnet/logger/visdomlogger.py
19 1 8
def tablemergekeys()
in torchnet/transform.py
17 9 0
def add()
in torchnet/meter/averagevaluemeter.py
17 3 3