awslabs / aws-perspective
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 555 units with 8,774 lines of code in units (25.9% of code).
    • 6 very long units (1,290 lines of code)
    • 14 long units (994 lines of code)
    • 82 medium size units (2,477 lines of code)
    • 157 small units (2,335 lines of code)
    • 296 very small units (1,678 lines of code)
14% | 11% | 28% | 26% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js15% | 12% | 27% | 25% | 19%
py0% | 0% | 40% | 41% | 18%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
source/frontend/src/components40% | 26% | 10% | 10% | 11%
source/frontend/src58% | 0% | 36% | 0% | 4%
source/frontend/src/Utils41% | 26% | 7% | 13% | 11%
source/backend/discovery/src0% | 3% | 30% | 38% | 27%
source/frontend/src/API0% | 14% | 32% | 36% | 16%
source/backend/functions/api0% | 15% | 57% | 13% | 13%
source/backend/functions/lambda-layers0% | 0% | 42% | 39% | 17%
source/backend/functions/cur-setup0% | 0% | 100% | 0% | 0%
source/backend/functions/settings0% | 0% | 64% | 7% | 28%
source/backend/functions/graph-api0% | 0% | 100% | 0% | 0%
source/backend/functions/drawio0% | 0% | 43% | 50% | 6%
source/backend/functions/cost-parser0% | 0% | 22% | 50% | 27%
source/backend/functions/search0% | 0% | 0% | 100% | 0%
source/backend/discovery/sandbox0% | 0% | 0% | 100% | 0%
source/backend/functions/setup0% | 0% | 0% | 54% | 45%
source/backend/functions/secured-edge0% | 0% | 0% | 100% | 0%
source/backend/functions/cleanup-bucket0% | 0% | 0% | 0% | 100%
source/backend/functions/cleanup-ecr0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
export default()
in source/frontend/src/components/Graph/Cytoscape.js
516 42 0
export default()
in source/frontend/src/components/LandingPage/GettingStartedImportForm.js
204 6 2
export default()
in source/frontend/src/Main.js
192 22 1
export default()
in source/frontend/src/Utils/Forms/FormAutoComplete.js
157 5 13
export default()
in source/frontend/src/components/Drawer/Costs/Report/CostForm.js
116 4 7
export default()
in source/frontend/src/components/Drawer/Settings/AccountManagement/Account/AccountAndRegionSettings.js
105 4 0
export default()
in source/frontend/src/Utils/Forms/FormField.js
99 6 12
data: fetchRequest()
in source/frontend/src/components/Drawer/Actions/QueryBuilder/QueryBuilderDialog.js
98 11 2
export default()
in source/frontend/src/components/Header/Search/SearchBar.js
93 2 1
export default()
in source/frontend/src/components/Drawer/Diagrams/ViewSelector/Graph/DiagramTable.js
90 1 11
export default()
in source/frontend/src/components/Drawer/Actions/TreeMenuExportMenu.js
81 8 1
export default()
in source/frontend/src/components/Graph/DeleteDialog.js
71 1 2
sameSecurityGroupAndSubnet()
in source/backend/discovery/src/discovery/eni-links.js
64 1 4
export default()
in source/frontend/src/components/Drawer/Settings/Costs/CostSettings.js
61 2 0
properties: mapToObj()
in source/backend/functions/api/src/index.js
60 7 3
export default()
in source/frontend/src/components/Drawer/ResourceSelector/TreeMenuResourceTypeMenu.js
59 1 0
export default()
in source/frontend/src/components/Graph/DetailsDialog/ResourceDetailsTagTable.js
58 1 5
export default()
in source/frontend/src/API/NodeFactory/NodeParsers/CloudFrontDistribution/CloudFrontDistributionDetails/CloudFrontDistributionItem.js
54 2 1
export default()
in source/frontend/src/API/NodeFactory/NodeParsers/EC2Instance/InstanceDetails/InstanceItem.js
53 1 1
async packageRDSClusters()
in source/backend/discovery/src/discovery/rdsCluster.js
53 1 3