facebookresearch / access
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 164 units with 1,234 lines of code in units (81.0% of code).
    • 1 very long units (105 lines of code)
    • 1 long units (70 lines of code)
    • 10 medium size units (265 lines of code)
    • 11 small units (146 lines of code)
    • 141 very small units (648 lines of code)
8% | 5% | 21% | 11% | 52%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py8% | 5% | 21% | 11% | 52%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
access/fairseq34% | 22% | 33% | 0% | 9%
access/resources0% | 0% | 45% | 15% | 39%
access0% | 0% | 5% | 15% | 78%
access/utils0% | 0% | 10% | 20% | 68%
access/evaluation0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def fairseq_train()
in access/fairseq/base.py
105 15 8
def _fairseq_generate()
in access/fairseq/base.py
70 8 12
def prepare_turkcorpus()
in access/resources/prepare.py
38 12 0
def find_best_parametrization()
in access/fairseq/main.py
31 6 4
def extract()
in access/resources/utils.py
27 5 2
26 3 2
def fairseq_generate()
in access/fairseq/base.py
26 1 10
25 5 3
def prepare_turkcorpus_lower()
in access/resources/prepare.py
25 5 0
def fairseq_preprocess()
in access/fairseq/base.py
24 1 1
def log_stdout()
in access/utils/helpers.py
22 5 2
def fairseq_train_and_evaluate()
in access/fairseq/main.py
21 2 6
def __enter__()
in access/utils/helpers.py
18 3 1
def prepare_wikilarge()
in access/resources/prepare.py
16 4 0
def get_preprocessed_simplifier()
in access/simplifiers.py
15 1 2
def learn_sentencepiece()
in access/preprocessors.py
14 4 1
def memoize_simplifier()
in access/simplifiers.py
13 3 1
def get_fairseq_simplifier()
in access/simplifiers.py
13 4 3
def prepare_models()
in access/resources/prepare.py
12 3 0
def mute()
in access/utils/helpers.py
12 3 2