facebookresearch / parcus
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 187 units with 3,631 lines of code in units (88.0% of code).
    • 8 very long units (1,052 lines of code)
    • 4 long units (289 lines of code)
    • 42 medium size units (1,392 lines of code)
    • 27 small units (414 lines of code)
    • 106 very small units (484 lines of code)
28% | 7% | 38% | 11% | 13%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py28% | 7% | 38% | 11% | 13%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
training40% | 7% | 49% | 1% | 1%
parsers/Spouse35% | 19% | 29% | 6% | 9%
parsers/MovieReview38% | 0% | 45% | 7% | 8%
parsers/Hatespeech25% | 12% | 39% | 9% | 12%
datasets0% | 0% | 25% | 42% | 32%
ROOT0% | 0% | 100% | 0% | 0%
models0% | 0% | 7% | 38% | 54%
utils0% | 0% | 55% | 0% | 44%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def compute()
in training/NeuralPatternMatchingTraining.py
168 32 16
def _convert_examples_to_features()
in parsers/Hatespeech/Hatespeech_Preprocess.py
152 7 3
def compute()
in training/BertBaselineTraining.py
147 38 15
def _convert_examples_to_features()
in parsers/Spouse/Spouse_Finetune_Preprocess.py
123 53 3
def compute()
in training/BertFinetuneTraining.py
122 15 13
def _convert_examples_to_features()
in parsers/MovieReview/MovieReview_Preprocess.py
115 53 3
def _convert_examples_to_features()
in parsers/Spouse/Spouse_Preprocess.py
114 53 3
def _convert_examples_to_features()
in parsers/MovieReview/MovieReview_Finetune_Preprocess.py
111 50 3
def compute()
in training/NGramLogRegTraining.py
83 14 14
def _convert_examples_to_features()
in parsers/Hatespeech/Hatespeech_Fasttext_Preprocess.py
75 19 2
def load_spouse()
in parsers/Spouse/Spouse_Preprocess.py
68 8 1
def process_embeddings()
in parsers/Spouse/Spouse_Dataset_Builder.py
63 22 2
def process_embeddings()
in parsers/Hatespeech/Hatespeech_Dataset_Fasttext_Builder.py
45 18 2
def compute_spouse_embeddings()
in parsers/Spouse/Spouse_Dataset_Builder.py
45 13 3
def trainLF()
in training/NeuralPatternMatchingTraining.py
45 9 8
def compute_hatespeech_embeddings()
in parsers/Hatespeech/Hatespeech_Dataset_Builder.py
44 12 3
def compute_moviereview_embeddings()
in parsers/MovieReview/MovieReview_Dataset_Builder.py
44 12 3
def bagging()
in training/NeuralPatternMatchingTraining.py
44 13 13
def process_embeddings()
in parsers/Spouse/Spouse_Finetune_Dataset_Builder.py
43 15 1
def process_embeddings()
in parsers/Hatespeech/Hatespeech_Dataset_Builder.py
42 17 2