facebookresearch / LAMA
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 109 units with 1,812 lines of code in units (82.4% of code).
    • 1 very long units (286 lines of code)
    • 3 long units (176 lines of code)
    • 20 medium size units (618 lines of code)
    • 31 small units (491 lines of code)
    • 54 very small units (241 lines of code)
15% | 9% | 34% | 27% | 13%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py15% | 9% | 34% | 27% | 13%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
scripts46% | 10% | 19% | 13% | 9%
lama/modules0% | 17% | 18% | 45% | 18%
lama0% | 0% | 68% | 20% | 11%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in scripts/batch_eval_KB_completion.py
286 58 3
def filter_samples()
in scripts/batch_eval_KB_completion.py
66 23 5
def get_batch_generation()
in lama/modules/roberta_connector.py
58 11 4
def get_batch_generation()
in lama/modules/elmo_connector.py
52 12 4
def main()
in lama/eval_generation.py
47 18 1
def __vocab_intersection()
in lama/vocab_intersection.py
44 16 2
def get_general_parser()
in lama/options.py
42 1 0
39 1 0
def __print_generation()
in lama/utils.py
39 9 10
def __get_input_tensors_batch()
in lama/modules/bert_connector.py
37 10 2
36 6 6
def get_ranking()
in lama/evaluation_metrics.py
35 11 8
def __add_elmo_args()
in lama/options.py
30 1 1
def __get_input_tensors()
in lama/modules/bert_connector.py
29 6 2
def __init__()
in lama/modules/gpt_connector.py
28 4 2
def main()
in scripts/create_lama_uhn.py
28 8 1
def __init__()
in lama/modules/bert_connector.py
25 3 3
def run_thread()
in scripts/batch_eval_KB_completion.py
25 5 1
def batchify()
in scripts/batch_eval_KB_completion.py
24 5 2
def __add_bert_args()
in lama/options.py
23 1 1