aws-samples / sagemaker-huggingface-nlp
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 16 units with 132 lines of code in units (45.8% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 0 medium size units (0 lines of code)
    • 6 small units (86 lines of code)
    • 10 very small units (46 lines of code)
0% | 0% | 0% | 65% | 34%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 0% | 0% | 65% | 34%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
scripts0% | 0% | 0% | 58% | 41%
ROOT0% | 0% | 0% | 72% | 27%
Alternative Visuals
Longest Units
Top 16 longest units
Unit# linesMcCabe index# params
def read_squad()
in distilbertqatrain.py
20 11 1
def read_squad()
in scripts/train.py
20 11 1
def add_end_idx()
in distilbertqatrain.py
12 8 2
def add_end_idx()
in scripts/train.py
12 8 2
def add_token_positions()
in distilbertqatrain.py
11 5 2
def add_token_positions()
in scripts/train.py
11 5 2
def get_data()
in distilbertqatrain.py
10 4 0
def input_handler()
in scripts/inference.py
10 3 2
def model_fn()
in scripts/inference.py
8 2 1
def output_handler()
in scripts/inference.py
6 2 2
def __init__()
in distilbertqatrain.py
2 1 2
def __getitem__()
in distilbertqatrain.py
2 2 2
def __len__()
in distilbertqatrain.py
2 1 1
def __init__()
in scripts/train.py
2 1 2
def __getitem__()
in scripts/train.py
2 2 2
def __len__()
in scripts/train.py
2 1 1