facebookresearch / curiosity
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 117 units with 1,800 lines of code in units (58.3% of code).
    • 3 very long units (307 lines of code)
    • 3 long units (267 lines of code)
    • 22 medium size units (611 lines of code)
    • 19 small units (305 lines of code)
    • 70 very small units (310 lines of code)
17% | 14% | 33% | 16% | 17%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py17% | 14% | 33% | 16% | 17%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
curiosity17% | 14% | 33% | 16% | 17%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def forward()
in curiosity/baseline_models.py
103 4 7
def text_to_instance()
in curiosity/baseline_reader.py
102 15 3
def text_to_instance()
in curiosity/baseline_reader.py
102 15 3
def text_to_instance()
in curiosity/reader.py
97 15 3
def __init__()
in curiosity/baseline_models.py
93 10 20
def gen_configs()
in curiosity/cli.py
77 8 2
def train()
in curiosity/stats.py
43 11 2
def train()
in curiosity/stats.py
43 11 2
def text_to_instance()
in curiosity/reader.py
36 9 3
def score()
in curiosity/stats.py
36 13 2
def text_to_instance()
in curiosity/reader.py
33 2 2
def score()
in curiosity/stats.py
32 8 2
def score()
in curiosity/stats.py
32 8 2
def majority()
in curiosity/cli.py
28 1 1
def majority_da()
in curiosity/cli.py
28 1 1
def majority_policy()
in curiosity/cli.py
28 1 1
def train()
in curiosity/stats.py
25 6 2
def _compute_da_loss()
in curiosity/baseline_models.py
24 1 7
def score()
in curiosity/stats.py
24 10 2
def forward()
in curiosity/bert.py
24 4 3