microsoft / react-native-windows
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 6,976 units with 72,690 lines of code in units (51.6% of code).
    • 50 very long units (9,537 lines of code)
    • 118 long units (7,761 lines of code)
    • 539 medium size units (16,104 lines of code)
    • 965 small units (14,031 lines of code)
    • 5,304 very small units (25,257 lines of code)
13% | 10% | 22% | 19% | 34%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp16% | 10% | 20% | 17% | 34%
ts11% | 18% | 26% | 24% | 19%
h8% | 4% | 20% | 15% | 51%
tsx26% | 23% | 24% | 11% | 13%
js6% | 8% | 23% | 20% | 40%
cs7% | 9% | 24% | 25% | 33%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
vnext/Microsoft.ReactNative11% | 9% | 24% | 19% | 34%
packages/react-native-platform-override37% | 12% | 14% | 13% | 21%
vnext/ReactCommon51% | 12% | 9% | 6% | 20%
packages/@react-native-windows13% | 20% | 29% | 18% | 17%
vnext/Microsoft.ReactNative.Managed.CodeGen22% | 20% | 33% | 10% | 13%
vnext/src13% | 9% | 16% | 27% | 33%
vnext/Mso7% | 4% | 13% | 13% | 60%
vnext/codegen18% | 13% | 38% | 16% | 13%
vnext/Shared3% | 10% | 23% | 23% | 38%
packages/@office-iss4% | 1% | 28% | 21% | 43%
packages/@rnw-scripts6% | 16% | 23% | 26% | 25%
packages/react-native-windows-init25% | 13% | 25% | 29% | 6%
packages/playground0% | 42% | 27% | 14% | 16%
vnext/Microsoft.ReactNative.Managed0% | 4% | 20% | 32% | 42%
vnext/Desktop0% | 15% | 16% | 19% | 48%
packages/@react-native0% | 16% | 13% | 8% | 62%
packages/sample-apps0% | 10% | 11% | 28% | 48%
vnext/Microsoft.ReactNative.Cxx0% | 1% | 12% | 23% | 62%
vnext/Desktop.IntegrationTests0% | 23% | 21% | 32% | 22%
vnext/Chakra0% | 0% | 30% | 27% | 42%
vnext/Common0% | 0% | 63% | 8% | 27%
vnext/Scripts0% | 0% | 41% | 10% | 47%
vnext/Microsoft.ReactNative.IntegrationTests0% | 0% | 13% | 13% | 72%
vnext0% | 0% | 63% | 0% | 36%
vnext/Microsoft.ReactNative.ComponentTests0% | 0% | 8% | 31% | 59%
vnext/template0% | 0% | 0% | 16% | 83%
vnext/Folly0% | 0% | 0% | 100% | 0%
vnext/Desktop.ABITests0% | 0% | 0% | 11% | 88%
vnext/stubs0% | 0% | 0% | 0% | 100%
vnext/include0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
static void YGNodelayoutImpl()
in vnext/ReactCommon/Yoga.cpp
736 141 15
static void YGNodelayoutImpl()
in packages/react-native-platform-override/src/e2etest/collateral/sampleOverrideRepo/ReactCommon/yoga/yoga/Yoga.cpp
721 140 15
return GTEST_MESSAGE_AT_()
in vnext/Mso/motifCpp/motifCppTest.h
403 27 4
function InternalTextInput()
in vnext/src/Libraries/Components/TextInput/TextInput.windows.js
325 71 1
export async function copyProjectTemplateAndReplace()
in packages/@react-native-windows/cli/src/generator-windows/index.ts
321 27 5
bool FrameworkElementViewManager::UpdateProperty()
in vnext/Microsoft.ReactNative/Views/FrameworkElementViewManager.cpp
316 112 3
static void StyleYogaNode()
in vnext/Microsoft.ReactNative/Modules/NativeUIManager.cpp
292 108 3
bool YGLayoutNodeInternal()
in vnext/ReactCommon/Yoga.cpp
234 38 15
bool YGLayoutNodeInternal()
in packages/react-native-platform-override/src/e2etest/collateral/sampleOverrideRepo/ReactCommon/yoga/yoga/Yoga.cpp
232 38 15
void TextInputShadowNode::updateProperties()
in vnext/Microsoft.ReactNative/Views/TextInputViewManager.cpp
214 91 1
public render()
in packages/@react-native-windows/tester/src/js/examples-win/Accessibility/AccessibilityExampleWindows.tsx
184 20 0
void DevMenuManager::CreateAndShowUI()
in vnext/Microsoft.ReactNative/Views/DevMenu.cpp
177 26 0
public render()
in packages/@react-native-windows/tester/src/js/examples-win/Flyout/FlyoutExample.windows.tsx
176 5 0
static void YGNodeAbsoluteLayoutChild()
in packages/react-native-platform-override/src/e2etest/collateral/sampleOverrideRepo/ReactCommon/yoga/yoga/Yoga.cpp
176 34 11
static void YGJustifyMainAxis()
in packages/react-native-platform-override/src/e2etest/collateral/sampleOverrideRepo/ReactCommon/yoga/yoga/Yoga.cpp
176 31 14
static void YGNodeAbsoluteLayoutChild()
in vnext/ReactCommon/Yoga.cpp
176 34 11
static void YGJustifyMainAxis()
in vnext/ReactCommon/Yoga.cpp
176 31 14
static float YGDistributeFreeSpaceSecondPass()
in packages/react-native-platform-override/src/e2etest/collateral/sampleOverrideRepo/ReactCommon/yoga/yoga/Yoga.cpp
175 35 17
175 35 17
static void YGNodeComputeFlexBasisForChild()
in packages/react-native-platform-override/src/e2etest/collateral/sampleOverrideRepo/ReactCommon/yoga/yoga/Yoga.cpp
173 43 14