bazelbuild / examples
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 35 units with 225 lines of code in units (14.0% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (62 lines of code)
    • 0 medium size units (0 lines of code)
    • 2 small units (23 lines of code)
    • 32 very small units (140 lines of code)
0% | 27% | 0% | 10% | 62%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
java0% | 46% | 0% | 9% | 43%
cc0% | 0% | 0% | 13% | 86%
cpp0% | 0% | 0% | 0% | 100%
m0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
tutorial/android0% | 88% | 0% | 0% | 11%
android/firebase-cloud-messaging0% | 0% | 0% | 57% | 42%
rules/starlark_configurations0% | 0% | 0% | 61% | 38%
cpp-tutorial/stage20% | 0% | 0% | 0% | 100%
cpp-tutorial/stage30% | 0% | 0% | 0% | 100%
cpp-tutorial/stage10% | 0% | 0% | 0% | 100%
android/tutorial0% | 0% | 0% | 0% | 100%
java-tutorial/src0% | 0% | 0% | 0% | 100%
android/ndk0% | 0% | 0% | 0% | 100%
third-party-dependencies0% | 0% | 0% | 0% | 100%
java-maven/src0% | 0% | 0% | 0% | 100%
tutorial/ios-app0% | 0% | 0% | 0% | 100%
rules/aspect0% | 0% | 0% | 0% | 100%
tutorial/backend0% | 0% | 0% | 0% | 100%
make-variables/testapp0% | 0% | 0% | 0% | 100%
rules/expand_template0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
public boolean onOptionsItemSelected()
in tutorial/android/src/main/java/com/google/bazel/example/android/activities/MainActivity.java
62 7 1
public void onMessageReceived()
in android/firebase-cloud-messaging/app/src/main/java/com/example/myapplication/MyFirebaseMessagingService.java
12 4 1
void runlib()
in rules/starlark_configurations/cc_binary_selectable_copts/lib.cc
11 1 0
int main()
in cpp-tutorial/stage2/main/hello-world.cc
9 2 2
int main()
in cpp-tutorial/stage3/main/hello-world.cc
9 2 2
int main()
in cpp-tutorial/stage1/main/hello-world.cc
9 2 2
public void onCreate()
in android/tutorial/src/main/java/com/example/bazel/MainActivity.java
9 1 1
int main()
in tutorial/ios-app/UrlGet/main.m
6 1 2
protected void onCreate()
in android/ndk/app/src/main/java/com/example/android/bazel/MainActivity.java
6 1 1
protected void onCreate()
in android/firebase-cloud-messaging/app/src/main/java/com/example/myapplication/MainActivity.java
5 1 1
public void doGet()
in tutorial/backend/src/main/java/com/google/bazel/example/app/MyAppServlet.java
4 1 2
protected void onCreate()
in tutorial/android/src/main/java/com/google/bazel/example/android/activities/MainActivity.java
4 1 1
public boolean onCreateOptionsMenu()
in tutorial/android/src/main/java/com/google/bazel/example/android/activities/MainActivity.java
4 1 1
int main()
in third-party-dependencies/hello_world.cpp
4 1 0
int sum()
in third-party-dependencies/my_lib.cpp
4 1 2
public static void main()
in java-maven/src/main/java/com/example/myproject/App.java
4 1 1
void print_localtime()
in cpp-tutorial/stage2/main/hello-world.cc
4 1 0
void print_localtime()
in cpp-tutorial/stage3/lib/hello-time.cc
4 1 0
void print_localtime()
in cpp-tutorial/stage1/main/hello-world.cc
4 1 0
int main()
in rules/starlark_configurations/cc_binary_selectable_copts/main.cc
4 1 2