RPM Community Forums

Mailing List Message of <popt-devel>

POPT 2.0: LCOV/GCOV and mccabe metrics

From: Jeff Johnson <n3npq@mac.com>
Date: Fri 18 Jun 2010 - 15:50:13 CEST
Message-id: <BDF105F7-F95B-4C81-B489-B71AC10A75B6@mac.com>
I use many automated tools to guide my hacking.

1) LCOV/GCOV coverage tests
	I've run lcov on POPT head yesterday, the results are here:
		http://jbj.org/files/popt/lcov-1.17/
	Note that function coverage at 100% is an immediate benefit
	of doing ISPRAS "shallow" testing. But click through
		/X/src/popt
	if you want to see what code is actually exercised by "make check".

2) mccabe metrics
	I use mccabe metrics mostly to confirm what I already know, where
	the "cesspools" are located.

Here are the 4 worst offenders from popt-1.16. (the 1st column is the metric,
lower is better, a metric of 30 tends to have a 50% chance of having a "bug"
through real world correlation testing):

80	80	160	1299	253	popt.c(1299): poptGetNextOpt
53	63	138	307	205	popthelp.c(307): singleOptionHelp
48	48	103	263	127	poptconfig.c(263): poptConfigLine
29	30	37	578	69	popt.c(579): findOption

And the same for POPT head:

74	76	171	1422	273	popt.c(1422): poptGetNextOpt
53	63	140	314	207	popthelp.c(314): singleOptionHelp
48	48	103	263	127	poptconfig.c(263): poptConfigLine
29	30	37	601	69	popt.c(602): findOption

The reduction from 80 -> 74 is due to a rewrite to handle POPT_ERROR_UNWANTEDARG.
I'll have the mccabe "cholestrol" count down below 50 before I'm done.

Meanwhile I'm going yo have to move from POPT -> RPM hacking for a bit, I
have rpm-5.3.2 to get out on 7/1, and I also need to try and see what
damage I've done by using POPT head under RPM for a bit.

73 de Jeff
Received on Fri Jun 18 15:50:56 2010
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.