aws-samples / realtime-web-analytics-workshop
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 22 units with 308 lines of code in units (4.9% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (89 lines of code)
    • 4 medium size units (132 lines of code)
    • 1 small units (11 lines of code)
    • 16 very small units (76 lines of code)
0% | 28% | 42% | 3% | 24%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js0% | 63% | 19% | 0% | 17%
py0% | 0% | 62% | 6% | 30%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
wasa0% | 63% | 19% | 0% | 17%
publishfunction0% | 0% | 91% | 0% | 8%
module-10% | 0% | 0% | 21% | 78%
module-40% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
function amendMetric()
in wasa/index.js
89 16 2
def lambda_handler()
in publishfunction/cwmetricstream.py
42 17 2
def lambda_handler()
in publishfunction/cwmetricstream2.py
35 5 2
def put_cloudwatch_metric()
in publishfunction/cwmetricstream.py
28 7 5
function upsert()
in wasa/index.js
27 4 2
def getEvent()
in module-1/test-beacon.py
11 1 0
def getIntMetricName()
in module-1/test-beacon.py
9 1 0
def getFloatMetricName()
in module-1/test-beacon.py
9 1 0
8 3 2
8 3 2
8 3 1
def getStringMetricName()
in module-1/test-beacon.py
8 1 0
def prettyUp()
in publishfunction/cwmetricstream2.py
6 2 1
def isWholeNumber()
in publishfunction/cwmetricstream2.py
4 3 1
def generateRandomLoadTime()
in module-4/generate-load-times.py
2 1 0
def getPage()
in module-1/test-beacon.py
2 1 0
def getUser()
in module-1/test-beacon.py
2 1 0
def getReferer()
in module-1/test-beacon.py
2 1 0
def getUserAgent()
in module-1/test-beacon.py
2 1 0
def getIntMetricValue()
in module-1/test-beacon.py
2 1 0