awslabs / aws-iot-device-client
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 262 units with 5,962 lines of code in units (71.8% of code).
    • 9 very long units (1,105 lines of code)
    • 25 long units (1,667 lines of code)
    • 53 medium size units (1,620 lines of code)
    • 66 small units (949 lines of code)
    • 109 very small units (621 lines of code)
18% | 27% | 27% | 15% | 10%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp18% | 28% | 27% | 15% | 10%
h0% | 0% | 0% | 65% | 34%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
source/fleetprovisioning66% | 10% | 22% | 0% | 0%
source/config21% | 31% | 33% | 6% | 6%
source43% | 17% | 24% | 8% | 5%
source/jobs10% | 30% | 34% | 14% | 10%
source/shadow0% | 60% | 7% | 22% | 10%
source/util0% | 13% | 46% | 30% | 9%
source/tunneling0% | 17% | 19% | 33% | 28%
source/logging0% | 18% | 5% | 40% | 34%
source/devicedefender0% | 0% | 49% | 30% | 19%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
int main()
in source/main.cpp
161 24 2
bool FleetProvisioning::CreateCertificateAndKey()
in source/fleetprovisioning/FleetProvisioning.cpp
148 17 1
bool FleetProvisioning::CreateCertificateUsingCSR()
in source/fleetprovisioning/FleetProvisioning.cpp
142 15 1
bool PlainConfig::LoadFromJson()
in source/config/Config.cpp
117 19 1
bool FleetProvisioning::RegisterThing()
in source/fleetprovisioning/FleetProvisioning.cpp
113 13 1
110 11 3
bool Config::ExportDefaultSetting()
in source/config/Config.cpp
109 2 1
bool Config::ParseCliArgs()
in source/config/Config.cpp
104 9 3
int SharedCrtResourceManager::establishConnection()
in source/SharedCrtResourceManager.cpp
101 10 1
void ConfigShadow::resetClientConfigWithJSON()
in source/shadow/ConfigShadow.cpp
97 16 3
96 17 1
void Config::PrintHelpMessage()
in source/config/Config.cpp
96 1 0
bool PlainConfig::Validate()
in source/config/Config.cpp
83 22 0
void PlainJobDocument::LoadFromJobDocument()
in source/jobs/JobDocument.cpp
81 23 1
int JobEngine::exec_cmd()
in source/jobs/JobEngine.cpp
81 13 2
int EnvUtils::AppendCwdToPath()
in source/util/EnvUtils.cpp
74 11 0
void SecureTunnelingFeature::OnSubscribeToTunnelsNotifyResponse()
in source/tunneling/SecureTunnelingFeature.cpp
71 12 2
void SampleShadowFeature::runFileMonitor()
in source/shadow/SampleShadowFeature.cpp
70 13 0
void ConfigShadow::reconfigureWithConfigShadow()
in source/shadow/ConfigShadow.cpp
69 10 2
bool FileLogger::start()
in source/logging/FileLogger.cpp
67 10 1