aws-samples / amazon-textract-transformer-pipeline
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 211 units with 2,505 lines of code in units (35.4% of code).
    • 3 very long units (384 lines of code)
    • 8 long units (575 lines of code)
    • 19 medium size units (581 lines of code)
    • 22 small units (296 lines of code)
    • 159 very small units (669 lines of code)
15% | 22% | 23% | 11% | 26%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py15% | 22% | 23% | 11% | 26%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
pipeline/review64% | 0% | 31% | 0% | 4%
annotation83% | 0% | 14% | 0% | 2%
pipeline/postprocessing36% | 0% | 21% | 4% | 37%
notebooks/src0% | 40% | 19% | 17% | 22%
pipeline/ocr0% | 42% | 25% | 12% | 19%
annotation/fn-SMGT-Post0% | 100% | 0% | 0% | 0%
notebooks/util0% | 0% | 24% | 17% | 57%
pipeline/fn-trigger0% | 0% | 77% | 22% | 0%
notebooks/preproc0% | 0% | 40% | 0% | 60%
pipeline/enrichment0% | 0% | 74% | 0% | 25%
pipeline0% | 0% | 0% | 32% | 67%
annotation/fn-SMGT-Pre0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def handler()
in pipeline/review/fn-review-callback/main.py
140 27 2
def __init__()
in annotation/__init__.py
137 1 4
def handler()
in pipeline/postprocessing/fn-postprocess/main.py
107 24 2
def handle_request()
in pipeline/ocr/fn-call-textract/main.py
99 21 2
def handler()
in annotation/fn-SMGT-Post/main.py
98 8 2
def train()
in notebooks/src/code/train.py
88 25 3
def handler()
in pipeline/ocr/sfn_semaphore/fn-acquire-lock/main.py
69 2 2
def predict_fn()
in notebooks/src/code/inference.py
62 21 2
def get_model()
in notebooks/src/code/train.py
56 14 2
def torch_call()
in notebooks/src/code/data/mlm.py
52 8 2
def input_fn()
in notebooks/src/code/inference.py
51 12 2
def compute_metrics()
in notebooks/src/code/data/ner.py
50 7 1
def handler()
in pipeline/review/fn-start-review/main.py
46 14 2
def __init__()
in notebooks/src/code/data/geometry.py
39 5 2
def handler()
in pipeline/ocr/fn-call-textract/main.py
35 9 2
def to_dict()
in pipeline/postprocessing/fn-postprocess/util/boxes.py
34 15 2
def to_dict()
in notebooks/util/postproc/boxes.py
34 15 2
def __init__()
in pipeline/ocr/sfn_semaphore/fn-acquire-lock/main.py
33 7 2
def fetch_textract_result()
in pipeline/ocr/fn-call-textract/main.py
32 10 2
def dataset_inputs()
in notebooks/src/code/data/base.py
32 9 1