awslabs / document-understanding-solution
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 384 units with 5,998 lines of code in units (42.8% of code).
    • 7 very long units (996 lines of code)
    • 17 long units (1,117 lines of code)
    • 58 medium size units (1,699 lines of code)
    • 68 small units (1,053 lines of code)
    • 234 very small units (1,133 lines of code)
16% | 18% | 28% | 17% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js25% | 20% | 26% | 11% | 14%
py4% | 15% | 30% | 25% | 23%
ts0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
source/app/pages47% | 8% | 16% | 16% | 10%
source/app/components18% | 31% | 36% | 4% | 8%
source/lambda/apiprocessor18% | 13% | 25% | 29% | 12%
source/lambda/helper0% | 21% | 36% | 22% | 19%
source/app/utils0% | 22% | 23% | 21% | 32%
source/lambda/textractor0% | 10% | 14% | 23% | 50%
source/lambda/jobresultprocessor0% | 47% | 22% | 27% | 2%
source/lambda/documentbulkprocessor0% | 55% | 0% | 11% | 33%
source/lambda/syncprocessor0% | 0% | 73% | 26% | 0%
source/lambda/documentprocessor0% | 0% | 65% | 19% | 15%
source/lambda/customResourceKendraIndex0% | 0% | 74% | 16% | 8%
source/app/store0% | 0% | 40% | 29% | 30%
source/lambda/asyncprocessor0% | 0% | 55% | 44% | 0%
source/lambda/customResourceKendraDataSource0% | 0% | 75% | 0% | 25%
source/lambda/kendraIndexPoller0% | 0% | 0% | 84% | 15%
deployment/document-understanding-cicd0% | 0% | 0% | 17% | 82%
deployment/logger0% | 0% | 0% | 0% | 100%
source/lambda/joberrorhandler0% | 0% | 0% | 0% | 100%
source/lib0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
function Document()
in source/app/pages/documents/view.js
309 32 7
function Documents()
in source/app/pages/documents/index.js
151 31 18
export default function Login()
in source/app/pages/index.js
118 11 0
def lambda_handler()
in source/lambda/apiprocessor/lambda_function.py
110 41 2
export default function KeyValueList()
in source/app/components/KeyValueList/KeyValueList.js
104 15 11
function FileUpload()
in source/app/components/FileUpload/FileUpload.js
102 11 1
function PersonaInfoModal()
in source/app/components/PersonaInfoModal/PersonaInfoModal.js
102 4 3
def search()
in source/lambda/apiprocessor/search.py
82 20 1
export function getPageWordsBySearch()
in source/app/utils/document.js
80 11 3
function SearchBar()
in source/app/components/SearchBar/SearchBar.js
80 4 8
export default function EntitiesCheckbox()
in source/app/components/EntitiesCheckbox/EntitiesCheckbox.js
76 12 13
export default function KendraResults()
in source/app/components/KendraResults/KendraResults.js
75 17 15
function Header()
in source/app/components/Header/Header.js
73 6 3
def processComprehend()
in source/lambda/helper/python/comprehendHelper.py
73 21 5
def indexDocument()
in source/lambda/textractor/python/og.py
64 12 3
export default function DocumentViewer()
in source/app/components/DocumentViewer/DocumentViewer.js
63 7 8
def indexDocument()
in source/lambda/helper/python/kendraHelper.py
63 19 8
def processRequest()
in source/lambda/jobresultprocessor/lambda_function.py
61 8 1
export default function DocumentListItem()
in source/app/components/DocumentListItem/DocumentListItem.js
58 4 6
function DocumentSearchBar()
in source/app/components/DocumentSearchBar/DocumentSearchBar.js
55 3 8