facebookresearch / MetaICL
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 630 units with 4,477 lines of code in units (53.6% of code).
    • 0 very long units (0 lines of code)
    • 13 long units (789 lines of code)
    • 14 medium size units (443 lines of code)
    • 47 small units (630 lines of code)
    • 556 very small units (2,615 lines of code)
0% | 17% | 9% | 14% | 58%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 17% | 9% | 14% | 58%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
preprocess0% | 9% | 6% | 11% | 71%
metaicl0% | 41% | 28% | 24% | 6%
ROOT0% | 100% | 0% | 0% | 0%
utils0% | 0% | 29% | 70% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
82 38 4
def main()
in test.py
76 25 2
73 36 6
def preprocess()
in preprocess/utils.py
72 40 3
def __init__()
in preprocess/tweet_eval.py
61 8 2
def load_prompts()
in preprocess/utils.py
60 23 1
def run()
in test.py
55 13 10
def __init__()
in preprocess/trec_finegrained.py
52 2 1
def process_test()
in preprocess/unifiedqa.py
52 21 4
def main()
in train.py
52 11 2
52 13 2
def process_train()
in preprocess/unifiedqa.py
51 17 5
def tensorize()
in metaicl/data.py
51 17 5
def do_train()
in metaicl/model.py
50 14 8
def save()
in preprocess/fewshot_gym_dataset.py
44 20 7
def setup_optimizer()
in metaicl/model.py
39 13 6
def apply_prompt()
in preprocess/utils.py
35 13 5
def load()
in metaicl/model.py
34 10 3
def generate_k_shot_data()
in preprocess/fewshot_gym_dataset.py
33 14 4
def build_gym()
in preprocess/_build_gym.py
32 13 1