awslabs / sagemaker-defect-detection
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 94 units with 1,165 lines of code in units (54.8% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (119 lines of code)
    • 16 medium size units (475 lines of code)
    • 17 small units (234 lines of code)
    • 59 very small units (337 lines of code)
0% | 10% | 40% | 20% | 28%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 10% | 40% | 20% | 28%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/sagemaker_defect_detection0% | 21% | 39% | 16% | 22%
src/sagemaker_defect_detection/utils0% | 0% | 55% | 19% | 24%
src/sagemaker_defect_detection/models0% | 0% | 39% | 27% | 33%
src/prepare_data0% | 0% | 58% | 21% | 19%
src/sagemaker_defect_detection/dataset0% | 0% | 36% | 19% | 44%
cloudformation/solution-assistant/src0% | 0% | 0% | 41% | 58%
scripts0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def setup()
in src/sagemaker_defect_detection/detector.py
66 13 2
def add_model_specific_args()
in src/sagemaker_defect_detection/classifier.py
53 1 1
def __init__()
in src/sagemaker_defect_detection/models/ddn.py
50 5 2
def add_model_specific_args()
in src/sagemaker_defect_detection/detector.py
48 1 1
def main()
in src/sagemaker_defect_detection/detector.py
47 8 1
def convert_to_coco_api()
in src/sagemaker_defect_detection/utils/coco_utils.py
35 4 1
def loadRes()
in src/sagemaker_defect_detection/utils/coco_eval.py
32 15 2
def main()
in src/prepare_data/neu.py
30 8 3
def main()
in src/sagemaker_defect_detection/classifier.py
27 5 1
def __getitem__()
in src/sagemaker_defect_detection/dataset/neu.py
26 4 2
def forward()
in src/sagemaker_defect_detection/detector.py
26 7 4
def evaluate()
in src/sagemaker_defect_detection/utils/coco_eval.py
25 14 1
def all_gather()
in src/sagemaker_defect_detection/utils/coco_eval.py
24 7 1
def get_transform()
in src/sagemaker_defect_detection/transforms.py
21 2 1
def get_augmentation()
in src/sagemaker_defect_detection/transforms.py
21 2 1
def prepare_for_coco_detection()
in src/sagemaker_defect_detection/utils/coco_eval.py
21 4 2
def createIndex()
in src/sagemaker_defect_detection/utils/coco_eval.py
21 10 1
def __init__()
in src/sagemaker_defect_detection/detector.py
21 1 0
def training_step()
in src/sagemaker_defect_detection/detector.py
19 11 3
def get_args()
in src/sagemaker_defect_detection/classifier.py
16 1 0