maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hilco Wijbenga" <>
Subject Proposal for maven-qc-plugin / maven-qc-report-plugin
Date Sat, 07 Oct 2006 06:21:11 GMT
Hi all,

A while ago I mentioned the idea of a quality number (without much
detail). It's a long weekend so I'd like to get started and see how
far I get. I'd appreciate comments!

--- maven-qc-plugin / maven-qc-report-plugin ---

1) General Idea
The maven-qc-plugin generates a "quality number" each time the build
reaches the verify phase. This quality number is a percentage where 0
denotes total chaos and 100 denotes absolute perfection (the user
defines what "perfect" is). The QN is the weighted sum of the results
of (e.g.) Surefire, IT, Cobertura, PMD, Checkstyle, FindBugs,

The maven-qc-report-plugin generates nice graphs. ;-)

2) How to calculate the QN?
Let's take Surefire, Cobertura, and PMD as an example. Others are similar.

surefire.x = (# tests - # failures) / # tests * surefire.weight
	--> [0 .. surefire.weight]
cobertura.x = (Sum i : 1<=i<=# tests : coverage fraction of test i) /
# tests * cobertura.weight
	--> [0 .. cobertura.weight] (coverage fraction = coverage percentage / 100)
pmd.x = max(0, 1 - (Max # violations -  # violations) / max #
violations) * pmd.weight
	--> [0 .. pmd.weight]

qn.x = (surefire.x + cobertura.x + pmd.x) / (surefire.weight +
cobertura.weight + pmd.weight)
	--> [0 .. 1]

3) (maven-qc-plugin) Default Lifecycle

3a) Phase verify
One of two things can be checked here:
a.	surefire.x >= previous(surefire.x) or fail
	cobertura.x >= previous(cobertura.x) or fail
	pmd.x >= previous(pmd.x) or fail
b. 	qn.x >= previous(qn.x) or fail
(if a succeeds, then b will succeed too)

3b) Phase install
a.	store Surefire, Cobertura, and PMD results (as a reference for
subsequent builds)
b.	store the calculated QN (as a reference for subsequent builds)

4) (maven-qc-report-plugin) Site Lifecycle

4a) Phase site
a.	graphs for surefire.x, cobertura.x, and pmd.x
b.	graph for qn.x

--- maven-qc-plugin / maven-qc-report-plugin ---

This will be my first plugin so I'm looking for some implementation
pointers, I guess.

I'm going to try and implement something that does nothing but force
the running of Surefire and Cobertura based on what's configured in

The maven-qc-plugin will force Surefire and Cobertura to run and log a
message. What if Surefire or Cobertura are also configured in <build>?
Does that make any difference? Should it?

I noticed that nothing gets run during 'pre-site' so that means that
during 'site' the reporting plugins must force running their
respective tools to run? How do I make sure that both Surefire and
Cobertura have run before maven-qc-report-plugin gets going? I read
about @execute but that doesn't seem like the right approach. I could
bind maven-qc-report-plugin to 'post-site', I guess, but then I would
have to tell everyone to run 'mvn post-site' instead of 'mvn site'?
That doesn't seem like a nice solution either. (Does *anything* use
'pre-site' or 'post-site'?)

I'll do some more digging but if someone could point me in the right


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message