kubernetes / 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 30 units with 328 lines of code in units (5.6% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 5 medium size units (154 lines of code)
    • 5 small units (72 lines of code)
    • 20 very small units (102 lines of code)
0% | 0% | 46% | 21% | 31%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go0% | 0% | 50% | 32% | 17%
js0% | 0% | 42% | 0% | 57%
java0% | 0% | 58% | 0% | 41%
py0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
staging/explorer0% | 0% | 100% | 0% | 0%
cassandra/go0% | 0% | 72% | 25% | 2%
guestbook-go/public0% | 0% | 53% | 0% | 46%
cassandra/java0% | 0% | 58% | 0% | 41%
guestbook-go0% | 0% | 0% | 51% | 48%
staging/https-nginx0% | 0% | 0% | 72% | 28%
staging/sharing-clusters0% | 0% | 0% | 70% | 29%
staging/cluster-dns0% | 0% | 0% | 0% | 100%
guestbook/php-redis0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func dns()
in staging/explorer/explorer.go
40 1 2
func main()
in staging/explorer/explorer.go
37 4 0
func GetEndpoints()
in cassandra/go/main.go
35 7 3
public List getSeeds()
in cassandra/java/src/main/java/io/k8s/cassandra/KubernetesSeedProvider.java
21 3 0
$()
in guestbook-go/public/script.js
21 1 1
func main()
in staging/https-nginx/make_secret.go
18 3 0
func main()
in staging/sharing-clusters/make_secret.go
17 2 0
func main()
in guestbook-go/main.go
14 1 0
func buildEndpoints()
in cassandra/go/main.go
12 2 1
func EnvHandler()
in guestbook-go/main.go
11 2 2
RedisController.prototype.onRedis = function()
in guestbook/php-redis/controllers.js
9 1 0
var handleSubmission = function()
in guestbook-go/public/script.js
9 2 1
private static String getEnvOrDefault()
in cassandra/java/src/main/java/io/k8s/cassandra/KubernetesSeedProvider.java
7 2 2
func ListRangeHandler()
in guestbook-go/main.go
7 1 2
func ListPushHandler()
in guestbook-go/main.go
7 1 2
func read()
in staging/https-nginx/make_secret.go
7 2 1
func read()
in staging/sharing-clusters/make_secret.go
7 2 1
var appendGuestbookEntries = function()
in guestbook-go/public/script.js
6 1 1
func HandleError()
in guestbook-go/main.go
6 2 2
def Main()
in staging/cluster-dns/images/frontend/client.py
6 1 0