android / tv-samples
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 1,179 units with 10,291 lines of code in units (55.9% of code).
    • 0 very long units (0 lines of code)
    • 12 long units (734 lines of code)
    • 89 medium size units (2,611 lines of code)
    • 174 small units (2,596 lines of code)
    • 904 very small units (4,350 lines of code)
0% | 7% | 25% | 25% | 42%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
java0% | 6% | 23% | 25% | 44%
kt0% | 7% | 31% | 24% | 36%
ts0% | 23% | 70% | 5% | 0%
py0% | 0% | 30% | 27% | 42%
js0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
LeanbackShowcase/app0% | 9% | 21% | 23% | 45%
ReferenceAppKotlin/app0% | 5% | 28% | 25% | 40%
Leanback/app0% | 2% | 22% | 34% | 40%
ReferenceAppKotlin/firebase0% | 22% | 65% | 5% | 6%
ClassicsKotlin/app0% | 15% | 40% | 19% | 24%
AccessibilityDemo/app0% | 0% | 34% | 19% | 46%
ReferenceAppKotlin/scripts0% | 0% | 37% | 41% | 21%
LeanbackShowcase/server0% | 0% | 24% | 17% | 58%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
public void onItemClicked()
in LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/MainFragment.java
93 16 4
public void onDownloadingCompleted()
in LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/room/controller/overview/LiveDataFragment.java
67 7 1
private void setupUi()
in LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/details/DetailViewExampleWithVideoBackgroundFragment.java
67 5 0
private void setupUi()
in LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/details/DetailViewExampleFragment.java
66 5 0
override fun onCreate()
in ReferenceAppKotlin/app/src/main/java/com/android/tv/reference/browse/BrowseFragment.kt
65 4 1
public void setItems()
in LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/room/adapter/ListAdapter.java
59 6 3
private static long downloadFromNetworkHelper()
in LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/room/network/NetworkManagerUtil.java
58 9 3
public Presenter getPresenter()
in LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/cards/presenters/CardPresenterSelector.java
55 20 1
public List buildMedia()
in Leanback/app/src/main/java/com/example/android/tvleanback/data/VideoDbBuilder.java
51 6 1
private Long addChannel()
in LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/rows/ChannelContents.java
51 6 2
override fun onCreate()
in ClassicsKotlin/app/src/main/java/com/android/tv/classics/fragments/NowPlayingFragment.kt
51 10 1
async function handleAuthCodeExchange()
in ReferenceAppKotlin/firebase/server/src/controller/functions/authentication.ts
51 4 2
private void subscribeToModel()
in LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/room/controller/detail/LiveDataDetailViewWithVideoBackgroundFragment.java
50 6 1
protected void onHandleIntent()
in Leanback/app/src/main/java/com/example/android/tvleanback/recommendation/UpdateRecommendationsService.java
47 7 1
private void fetchVideosInfo()
in LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/grid/VideoGridExampleFragment.java
47 8 1
public void onLoadFinished()
in Leanback/app/src/main/java/com/example/android/tvleanback/ui/MainFragment.java
46 6 2
private void prepareNewMedia()
in LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/media/MusicPlaybackService.java
46 6 0
override fun onCreate()
in ClassicsKotlin/app/src/main/java/com/android/tv/classics/fragments/MediaBrowserFragment.kt
45 2 1
async function handleStreamlinedLinkOrCreate()
in ReferenceAppKotlin/firebase/server/src/controller/functions/authentication.ts
42 3 3
override fun onCreateView()
in ReferenceAppKotlin/app/src/main/java/com/android/tv/reference/auth/SignInFragment.kt
41 1 3