awslabs / sagemaker-defect-detection
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 94 units with 1,165 lines of code in units (54.8% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 4 medium complex units (142 lines of code)
    • 7 simple units (176 lines of code)
    • 83 very simple units (847 lines of code)
0% | 0% | 12% | 15% | 72%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
py0% | 0% | 12% | 15% | 72%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
src/sagemaker_defect_detection0% | 0% | 15% | 15% | 68%
src/sagemaker_defect_detection/utils0% | 0% | 19% | 20% | 59%
src/prepare_data0% | 0% | 0% | 58% | 41%
src/sagemaker_defect_detection/models0% | 0% | 0% | 0% | 100%
src/sagemaker_defect_detection/dataset0% | 0% | 0% | 0% | 100%
cloudformation/solution-assistant/src0% | 0% | 0% | 0% | 100%
scripts0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def loadRes()
in src/sagemaker_defect_detection/utils/coco_eval.py
32 15 2
def evaluate()
in src/sagemaker_defect_detection/utils/coco_eval.py
25 14 1
def setup()
in src/sagemaker_defect_detection/detector.py
66 13 2
def training_step()
in src/sagemaker_defect_detection/detector.py
19 11 3
def createIndex()
in src/sagemaker_defect_detection/utils/coco_eval.py
21 10 1
def validation_step()
in src/sagemaker_defect_detection/detector.py
13 8 3
def main()
in src/sagemaker_defect_detection/detector.py
47 8 1
def main()
in src/prepare_data/neu.py
30 8 3
def load_checkpoint()
in src/sagemaker_defect_detection/utils/__init__.py
15 7 3
def all_gather()
in src/sagemaker_defect_detection/utils/coco_eval.py
24 7 1
def forward()
in src/sagemaker_defect_detection/detector.py
26 7 4
def __init__()
in src/sagemaker_defect_detection/models/ddn.py
50 5 2
def main()
in src/sagemaker_defect_detection/classifier.py
27 5 1
def main()
in scripts/find_best_ckpt.py
9 5 2
def _make_dataset()
in src/sagemaker_defect_detection/dataset/neu.py
14 4 1
def _find_classes()
in src/sagemaker_defect_detection/dataset/neu.py
4 4 1
def _get_bboxes()
in src/sagemaker_defect_detection/dataset/neu.py
8 4 1
def __getitem__()
in src/sagemaker_defect_detection/dataset/neu.py
26 4 2
def str2bool()
in src/sagemaker_defect_detection/utils/__init__.py
9 4 2
def convert_to_coco_api()
in src/sagemaker_defect_detection/utils/coco_utils.py
35 4 1