facebookresearch / UNOC
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 403 units with 4,366 lines of code in units (88.8% of code).
    • 2 very long units (235 lines of code)
    • 7 long units (437 lines of code)
    • 48 medium size units (1,539 lines of code)
    • 63 small units (941 lines of code)
    • 283 very small units (1,214 lines of code)
5% | 10% | 35% | 21% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py5% | 10% | 35% | 21% | 27%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src6% | 12% | 35% | 18% | 27%
src/parsers0% | 0% | 47% | 31% | 20%
src/npybvh0% | 0% | 24% | 41% | 34%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def create_training_data_config()
in src/data_creation_torch.py
125 39 7
def eval()
in src/eval.py
110 25 4
def build_hierarchy()
in src/definitions.py
76 1 1
def plot_evaluation()
in src/eval.py
71 13 10
def train_config()
in src/train.py
66 16 3
def __init__()
in src/training_config.py
60 3 27
def positions_to_local_rot()
in src/definitions.py
56 12 2
54 2 1
54 2 1
49 4 2
def plot()
in src/plots.py
47 22 7
47 11 5
47 9 9
45 9 4
def up_forward_to_quat()
in src/quaternion.py
44 5 3
44 8 11
42 6 5
def fix_bone_lengths()
in src/utils.py
42 11 6
39 6 4
def batch_convert_frames()
in src/parsers/unoc_parser.py
38 10 6