microsoft / CMake
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 13,730 units with 315,419 lines of code in units (45.6% of code).
    • 449 very long units (86,198 lines of code)
    • 904 long units (61,972 lines of code)
    • 2,661 medium size units (83,707 lines of code)
    • 3,224 small units (47,719 lines of code)
    • 6,492 very small units (35,823 lines of code)
27% | 19% | 26% | 15% | 11%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c29% | 20% | 26% | 14% | 9%
cxx27% | 18% | 27% | 15% | 11%
cpp3% | 22% | 29% | 23% | 21%
h1% | 8% | 13% | 15% | 60%
py0% | 19% | 12% | 40% | 27%
cc0% | 0% | 0% | 100% | 0%
hxx0% | 0% | 0% | 15% | 84%
pl0% | 0% | 0% | 73% | 26%
m0% | 0% | 0% | 100% | 0%
mm0% | 0% | 0% | 100% | 0%
inl0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Source25% | 19% | 27% | 15% | 12%
Utilities/cmcurl39% | 20% | 22% | 11% | 6%
Source/kwsys34% | 14% | 29% | 12% | 9%
Source/CTest31% | 18% | 25% | 13% | 10%
Utilities/cmlibuv16% | 21% | 33% | 16% | 12%
Source/CPack41% | 15% | 20% | 13% | 8%
Utilities/cmzstd18% | 22% | 23% | 18% | 17%
Utilities/cmnghttp227% | 13% | 26% | 18% | 13%
Utilities/cmlibarchive23% | 31% | 26% | 11% | 8%
Utilities/cmbzip243% | 25% | 15% | 8% | 7%
Utilities/cmzlib30% | 20% | 32% | 11% | 5%
Source/CursesDialog10% | 19% | 34% | 21% | 14%
Source/QtDialog8% | 13% | 31% | 19% | 28%
Utilities/cmexpat85% | 0% | 14% | 0% | 0%
Utilities/cmliblzma10% | 24% | 33% | 15% | 16%
Utilities/cmjsoncpp5% | 20% | 29% | 22% | 21%
Source/LexerParser0% | 15% | 34% | 31% | 19%
Utilities/std0% | 43% | 11% | 22% | 22%
Utilities/cmlibrhash0% | 13% | 56% | 16% | 13%
Utilities/Sphinx0% | 19% | 8% | 46% | 26%
Utilities/cmvssetup0% | 0% | 46% | 47% | 5%
Help/guide0% | 0% | 3% | 88% | 8%
Modules0% | 0% | 0% | 47% | 52%
Source/Checks0% | 0% | 0% | 52% | 47%
Auxiliary/vim0% | 0% | 0% | 73% | 26%
Utilities/Release0% | 0% | 0% | 72% | 27%
Modules/FindMPI0% | 0% | 0% | 100% | 0%
Modules/FortranCInterface0% | 0% | 0% | 0% | 100%
Modules/CheckIPOSupported0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
CURLcode Curl_vsetopt()
in Utilities/cmcurl/lib/setopt.c
1837 562 3
static CURLcode ssh_statemach_act()
in Utilities/cmcurl/lib/vssh/libssh2.c
1655 335 2
cxx
bool SystemTools::FileIsDirectory()
in Source/kwsys/SystemTools.cxx
1411 313 1
static CURLcode myssh_statemach_act()
in Utilities/cmcurl/lib/vssh/libssh.c
1071 218 2
ssize_t nghttp2_session_mem_recv()
in Utilities/cmnghttp2/lib/nghttp2_session.c
1047 234 3
cxx
766 249 2
cxx
int cmCoreTryCompile::TryCompileCode()
in Source/cmCoreTryCompile.cxx
659 141 2
size_t Curl_ftp_parselist()
in Utilities/cmcurl/lib/ftplistparser.c
659 164 4
cxx
void cmMakefileTargetGenerator::WriteObjectRuleFiles()
in Source/cmMakefileTargetGenerator.cxx
600 113 1
int ZEXPORT inflate()
in Utilities/cmzlib/inflate.c
587 172 2
cxx
bool HandleTargetsMode()
in Source/cmInstallCommand.cxx
583 154 2
static CURLMcode multi_runsingle()
in Utilities/cmcurl/lib/multi.c
581 144 3
cxx
void cmGlobalXCodeGenerator::CreateBuildSettings()
in Source/cmGlobalXCodeGenerator.cxx
534 131 3
cxx
void cmake::SetArgs()
in Source/cmake.cxx
499 71 1
static CURLcode ossl_connect_step1()
in Utilities/cmcurl/lib/vtls/openssl.c
493 132 3
471 117 0
cxx
void cmVisualStudio10TargetGenerator::Generate()
in Source/cmVisualStudio10TargetGenerator.cxx
466 105 0
Int32 BZ2_decompress()
in Utilities/cmbzip2/decompress.c
438 99 1
CURLproxycode Curl_SOCKS5()
in Utilities/cmcurl/lib/socks.c
435 109 7
CURLcode Curl_SOCKS5_gssapi_negotiate()
in Utilities/cmcurl/lib/socks_sspi.c
417 66 2