awslabs / diagram-maker
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 262 units with 3,774 lines of code in units (41.3% of code).
    • 1 very long units (121 lines of code)
    • 14 long units (1,123 lines of code)
    • 33 medium size units (907 lines of code)
    • 44 small units (647 lines of code)
    • 170 very small units (976 lines of code)
3% | 29% | 24% | 17% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts3% | 32% | 18% | 15% | 28%
tsx0% | 10% | 59% | 23% | 6%
js0% | 0% | 0% | 64% | 35%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/state7% | 26% | 17% | 20% | 27%
integ/ActionInterceptor0% | 100% | 0% | 0% | 0%
integ/DarkTheme0% | 100% | 0% | 0% | 0%
integ/BoundaryRectangular0% | 100% | 0% | 0% | 0%
integ/TopBottomRectangular0% | 100% | 0% | 0% | 0%
integ/LeftRightRectangular0% | 100% | 0% | 0% | 0%
integ/Layout0% | 100% | 0% | 0% | 0%
integ/Plugins0% | 95% | 0% | 0% | 4%
integ/BoundaryCircular0% | 100% | 0% | 0% | 0%
src/components0% | 10% | 58% | 23% | 7%
integ0% | 0% | 45% | 15% | 39%
src/service0% | 0% | 25% | 19% | 54%
src/testing0% | 0% | 69% | 0% | 30%
cypress/common0% | 0% | 0% | 25% | 74%
ROOT0% | 0% | 0% | 64% | 35%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
export default function nodeReducer()
in src/state/node/nodeReducer.ts
121 22 2
export default function hierarchicalLayout()
in src/state/layout/hierarchicalLayout.ts
98 14 2
function arrangeEvenly()
in src/state/layout/hierarchicalLayout.ts
92 18 3
export default function workspaceReducer()
in src/state/workspace/workspaceReducer.ts
90 13 2
export function renderDiagramMaker()
in integ/ActionInterceptor/render.ts
88 6 0
export function renderDiagramMaker()
in integ/DarkTheme/render.ts
83 4 0
export function renderDiagramMaker()
in integ/BoundaryRectangular/render.ts
82 3 0
export function renderDiagramMaker()
in integ/TopBottomRectangular/render.ts
82 4 0
export function renderDiagramMaker()
in integ/LeftRightRectangular/render.ts
82 4 0
export function renderDiagramMaker()
in integ/Layout/render.ts
82 4 0
export function renderDiagramMaker()
in integ/BoundaryCircular/render.ts
81 5 0
export function renderDiagramMaker()
in integ/Plugins/render.ts
81 4 0
function applyGravity()
in src/state/layout/hierarchicalLayout.ts
71 23 3
export default function edgeReducer()
in src/state/edge/edgeReducer.ts
60 10 2
private renderEdgeBadges()
in src/components/view/View.tsx
51 2 0
export default function editorReducer()
in src/state/editor/editorReducer.ts
48 10 2
public render()
in src/components/view/View.tsx
47 1 0
export default function workflowLayout()
in src/state/layout/workflowLayout.ts
46 3 2
private getEdges()
in src/components/view/View.tsx
37 5 0
export function adjustWorkspace()
in src/state/layout/layoutReducer.ts
36 3 1