aws-samples / amazon-sagemaker-architecting-for-ml
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 15 units with 145 lines of code in units (85.8% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 1 medium size units (25 lines of code)
    • 4 small units (52 lines of code)
    • 10 very small units (68 lines of code)
0% | 0% | 17% | 35% | 46%
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% | 17% | 35% | 46%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Example-Project0% | 0% | 26% | 55% | 17%
Starter-Code0% | 0% | 0% | 0% | 100%
Example-Project/src0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 15 longest units
Unit# linesMcCabe index# params
def write_rows()
in Example-Project/utils.py
25 5 5
def get_cell_placements()
in Example-Project/utils.py
19 5 1
def get_code()
in Example-Project/utils.py
11 3 1
def get_markdown()
in Example-Project/utils.py
11 3 1
def parse_notebook()
in Example-Project/utils.py
11 3 4
def lambda_handler()
in Starter-Code/clean-sm-resources.py
10 1 2
def get_rows()
in Example-Project/utils.py
9 4 2
def get_model_name()
in Example-Project/src/tune_gpt.py
8 4 1
def get_notebook_names()
in Starter-Code/clean-sm-resources.py
8 3 2
def initialize_output()
in Example-Project/utils.py
7 1 1
def get_endpoint_names()
in Starter-Code/clean-sm-resources.py
7 2 1
def stop_notebook_instances()
in Starter-Code/clean-sm-resources.py
7 2 2
def save_to_s3()
in Example-Project/src/tune_gpt.py
5 1 4
def delete_endpoints()
in Starter-Code/clean-sm-resources.py
4 2 2
def get_file_name()
in Example-Project/src/tune_gpt.py
3 2 3