microsoft / nlp-recipes
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 656 units with 8,219 lines of code in units (59.0% of code).
    • 3 very long units (352 lines of code)
    • 12 long units (824 lines of code)
    • 95 medium size units (3,052 lines of code)
    • 143 small units (2,031 lines of code)
    • 403 very small units (1,960 lines of code)
4% | 10% | 37% | 24% | 23%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py3% | 8% | 36% | 26% | 25%
c13% | 24% | 40% | 10% | 10%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
utils_nlp/models4% | 11% | 33% | 25% | 25%
utils_nlp/eval5% | 6% | 50% | 21% | 16%
utils_nlp/dataset0% | 17% | 30% | 20% | 32%
utils_nlp/common0% | 0% | 32% | 28% | 39%
utils_nlp/azureml0% | 0% | 24% | 40% | 35%
utils_nlp/interpreter0% | 0% | 0% | 95% | 4%
tools0% | 0% | 0% | 64% | 35%
utils_nlp/language_utils0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
int get_cooccurrence()
in utils_nlp/models/glove/src/cooccur.c
127 44 0
def _fast_translate_batch()
in utils_nlp/models/transformers/bertsum/predictor.py
121 32 6
def _compute_ngrams_lcs()
in utils_nlp/eval/rouge/rouge_ext.py
104 32 4
int save_params()
in utils_nlp/models/glove/src/glove.c
96 43 1
int main()
in utils_nlp/models/glove/src/glove.c
90 24 2
def get_parallel_minibatch()
in utils_nlp/models/gensen/utils.py
80 18 4
def run()
in utils_nlp/eval/SentEval/senteval/tools/ranking.py
73 9 1
def _create_qa_example()
in utils_nlp/models/transformers/question_answering.py
73 23 2
def CNNDMSummarizationDataset()
in utils_nlp/dataset/cnndm.py
71 7 2
def collate()
in utils_nlp/models/transformers/abstractive_summarization_bertsum.py
64 15 5
def load_pandas_df()
in utils_nlp/dataset/squad.py
62 12 3
def eval()
in utils_nlp/eval/SentEval/senteval/engine.py
59 28 2
def get_hidden_states()
in utils_nlp/models/bert/sequence_encoding.py
52 6 3
int train_glove()
in utils_nlp/models/glove/src/glove.c
52 17 0
def _get_final_text()
in utils_nlp/models/transformers/question_answering.py
52 21 4
def run()
in utils_nlp/eval/SentEval/senteval/sick.py
50 9 3
int get_counts()
in utils_nlp/models/glove/src/vocab_count.c
50 19 0
int merge_files()
in utils_nlp/models/glove/src/cooccur.c
49 10 1
def advance()
in utils_nlp/models/transformers/bertsum/beam.py
49 19 3
def encode_single()
in utils_nlp/models/transformers/extractive_summarization.py
49 30 4