aws-amplify / docs
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 51 units with 928 lines of code in units (11.3% of code).
    • 2 very long units (220 lines of code)
    • 2 long units (117 lines of code)
    • 8 medium size units (254 lines of code)
    • 14 small units (189 lines of code)
    • 25 very small units (148 lines of code)
23% | 12% | 27% | 20% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js97% | 0% | 0% | 0% | 2%
ts34% | 20% | 8% | 18% | 18%
tsx0% | 11% | 45% | 26% | 17%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT97% | 0% | 0% | 0% | 2%
tasks77% | 0% | 0% | 8% | 13%
src/utils0% | 36% | 14% | 26% | 22%
src/components0% | 11% | 45% | 26% | 17%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
function generatePathMap()
in generatePathMap.cjs.js
115 1 0
const grab = function()
in tasks/migrate.ts
105 20 0
export function traverseHeadings()
in src/utils/traverseHeadings.ts
61 24 2
export default function LandingHeroCTA()
in src/components/LandingHeroCTA/index.tsx
56 2 0
export default function FeatureFlagSummary()
in src/components/FeatureFlags/FeatureFlagSummary.tsx
42 2 2
export default function BlockSwitcher()
in src/components/BlockSwitcher/index.tsx
38 4 1
export default function SearchBar()
in src/components/SearchBar/index.tsx
35 2 0
export default function UniversalNav()
in src/components/UniversalNav/index.tsx
33 2 3
function Content()
in src/components/UiComponentProps/index.tsx
32 4 2
render()
in src/components/Menu/Directory/index.tsx
27 3 0
function gatherFilters()
in src/utils/gatherFilters.ts
25 10 1
export default function UiComponentProps()
in src/components/UiComponentProps/index.tsx
22 4 4
export function transformData()
in src/utils/transform-search-data.ts
19 5 1
const getActiveIndex = function()
in src/components/BlockSwitcher/index.tsx
16 3 2
export default function FilterChildren()
in src/components/FilterChildren/index.tsx
15 5 1
render()
in src/components/CodeBlock/index.tsx
14 3 0
render()
in src/components/Menu/MenuOpenButton/index.tsx
14 2 0
export function isProductRoot()
in src/utils/getLocalDirectory.ts
13 4 1
function createIssueLink()
in src/components/Menu/RepoActions/index.tsx
13 1 2
function Prev()
in src/components/NextPrevious/index.tsx
13 1 1