microsoft / ModSecurity
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 852 units with 29,436 lines of code in units (46.0% of code).
    • 52 very long units (11,027 lines of code)
    • 90 long units (6,548 lines of code)
    • 214 medium size units (6,883 lines of code)
    • 204 small units (3,062 lines of code)
    • 292 very small units (1,916 lines of code)
37% | 22% | 23% | 10% | 6%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c40% | 21% | 22% | 9% | 6%
cpp8% | 23% | 36% | 23% | 7%
pl0% | 37% | 27% | 15% | 19%
cc0% | 54% | 14% | 8% | 23%
h0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
apache240% | 20% | 22% | 10% | 6%
mlogc28% | 41% | 21% | 5% | 3%
alp222% | 40% | 25% | 7% | 4%
standalone16% | 26% | 31% | 7% | 17%
tools0% | 37% | 27% | 15% | 19%
iis0% | 37% | 38% | 20% | 4%
nginx0% | 47% | 16% | 35% | 0%
validator0% | 0% | 68% | 0% | 31%
ext0% | 0% | 10% | 70% | 19%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
1129 2 1
void sec_audit_logger_json()
in apache2/msc_logging.c
612 151 1
585 1 1
void sec_audit_logger_native()
in apache2/msc_logging.c
549 149 1
372 88 2
int libinjection_sqli_fold()
in apache2/libinjection/libinjection_sqli.c
360 178 1
334 99 2
static int collection_store_ex()
in apache2/persist_dbm.c
316 45 3
int hash_response_body_links()
in apache2/msc_crypt.c
302 100 1
apr_status_t output_filter()
in apache2/apache2_io.c
283 84 2
int do_hash_method()
in apache2/msc_crypt.c
279 76 3
278 63 4
246 63 4
int perform_interception()
in apache2/mod_security2.c
221 48 1
194 1 1
int geo_lookup()
in apache2/msc_geo.c
192 28 4
185 32 1
static int msre_op_rx_execute()
in apache2/re_operators.c
179 52 4
int inject_hashed_response_body()
in apache2/msc_crypt.c
172 49 2
int multipart_process_chunk()
in apache2/msc_multipart.c
166 55 4