aws-samples / aws-deepcomposer-samples
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 133 units with 1,340 lines of code in units (84.7% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 14 medium size units (454 lines of code)
    • 31 small units (460 lines of code)
    • 88 very small units (426 lines of code)
0% | 0% | 33% | 34% | 31%
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% | 33% | 34% | 31%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ar-cnn0% | 0% | 50% | 33% | 16%
gan/utils0% | 0% | 35% | 21% | 42%
reinvent-labs/lab-2/utils0% | 0% | 35% | 21% | 42%
transformer-xl/utils0% | 0% | 14% | 47% | 37%
ar-cnn/utils0% | 0% | 24% | 63% | 11%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def convert()
in transformer-xl/utils/music_encoder.py
50 11 4
def sample_notes_from_model()
in ar-cnn/inference.py
41 14 12
def build_model()
in ar-cnn/model.py
40 4 1
def plot_pianoroll()
in gan/utils/display_utils.py
40 10 10
def plot_pianoroll()
in reinvent-labs/lab-2/utils/display_utils.py
40 10 10
def generate_training_pairs()
in ar-cnn/data_generator.py
39 7 1
def plot_metrics()
in gan/utils/metrics_utils.py
31 8 1
def plot_metrics()
in reinvent-labs/lab-2/utils/metrics_utils.py
31 8 1
def __init__()
in ar-cnn/model.py
26 7 12
def show_pianoroll()
in gan/utils/display_utils.py
24 6 8
def show_pianoroll()
in reinvent-labs/lab-2/utils/display_utils.py
24 6 8
def process_midi()
in ar-cnn/utils/midi_utils.py
23 1 2
def up_sampling()
in ar-cnn/model.py
23 4 6
def down_sampling()
in ar-cnn/model.py
22 4 5
def convert_midi_to_tensor()
in ar-cnn/inference.py
20 4 2
def sample_multiple()
in ar-cnn/inference.py
19 2 6
def __init__()
in transformer-xl/utils/performance_event_repo.py
19 4 8
def decode_event()
in transformer-xl/utils/performance_event_repo.py
19 5 2
def __init__()
in ar-cnn/data_generator.py
18 1 13
def save_pianoroll_as_midi()
in gan/utils/midi_utils.py
18 2 12