microsoft / MXDial-IoT-Sample
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 85 units with 1,029 lines of code in units (28.5% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (116 lines of code)
    • 16 medium size units (462 lines of code)
    • 9 small units (121 lines of code)
    • 58 very small units (330 lines of code)
0% | 11% | 44% | 11% | 32%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ino0% | 62% | 16% | 15% | 6%
js0% | 0% | 70% | 8% | 21%
cs0% | 0% | 39% | 12% | 47%
cpp0% | 0% | 36% | 13% | 49%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
mxdevice/Device0% | 41% | 22% | 14% | 20%
frontend/mx/src0% | 0% | 72% | 8% | 18%
backend/MXApi/Filters0% | 0% | 76% | 0% | 23%
backend/MXApi/Services0% | 0% | 49% | 33% | 16%
backend/MXApi0% | 0% | 100% | 0% | 0%
backend/MXApi/Jobs0% | 0% | 42% | 0% | 58%
backend/MXApi/Models0% | 0% | 0% | 36% | 63%
backend/MXApi/Controllers0% | 0% | 0% | 0% | 100%
backend/MXApi/Helpers0% | 0% | 0% | 0% | 100%
backend/MXApi/Resolvers0% | 0% | 0% | 0% | 100%
frontend/common/containers0% | 0% | 0% | 0% | 100%
backend/MXApi/Config0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
ino
void setup()
in mxdevice/Device/MXDeviceDemo.ino
61 4 0
ino
void loop()
in mxdevice/Device/MXDeviceDemo.ino
55 14 0
componentWillReceiveProps()
in frontend/mx/src/containers/app.js
48 14 1
private async Task ReceiveMessagesFromDeviceAsync()
in backend/MXApi/Services/MessagingService.cs
41 6 2
private static Tuple ExtractUserNameAndPassword()
in backend/MXApi/Filters/BasicAuthorizeFilter.cs
40 5 1
render()
in frontend/mx/src/components/dashboard-gauge.js
36 2 0
void parseTwinMessage()
in mxdevice/Device/utility.cpp
34 6 2
ino
static int deviceMethodCallback()
in mxdevice/Device/MXDeviceDemo.ino
30 3 5
componentWillReceiveProps()
in frontend/mx/src/containers/threshold-notifications.js
28 6 1
public Task AuthenticateAsync()
in backend/MXApi/Filters/BasicAuthorizeFilter.cs
27 4 2
render()
in frontend/mx/src/components/trigger-overlay.js
24 4 0
render()
in frontend/mx/src/containers/app.js
24 2 0
render()
in frontend/mx/src/containers/dps-animation.js
23 2 0
public void Configuration()
in backend/MXApi/Startup.cs
22 1 1
render()
in frontend/mx/src/components/sound-level-gauge.js
22 1 0
public void Execute()
in backend/MXApi/Jobs/EventHubProcessingJob.cs
21 3 0
public void ReadMessages()
in backend/MXApi/Services/MessagingService.cs
21 4 1
constructor()
in frontend/mx/src/mock/events.js
21 1 2
ino
static void initWifi()
in mxdevice/Device/MXDeviceDemo.ino
16 2 0
public async Task InvokeDeviceMethod()
in backend/MXApi/Services/IoTHubService.cs
15 2 3