Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 68072 invoked from network); 2 Nov 2007 17:22:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Nov 2007 17:22:29 -0000 Received: (qmail 69171 invoked by uid 500); 2 Nov 2007 17:22:16 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 69142 invoked by uid 500); 2 Nov 2007 17:22:16 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 69133 invoked by uid 99); 2 Nov 2007 17:22:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Nov 2007 10:22:16 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=GAPPY_SUBJECT,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of david.vancouvering@gmail.com designates 64.233.166.178 as permitted sender) Received: from [64.233.166.178] (HELO py-out-1112.google.com) (64.233.166.178) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Nov 2007 17:22:17 +0000 Received: by py-out-1112.google.com with SMTP id p76so1686147pyb for ; Fri, 02 Nov 2007 10:21:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=8bAW/Bldl4c2bvfHrQJyVEfv4RDvISRPK7PkS5H9Mqw=; b=Y/bapdyMqSTUlAN6MVkLx26cSDLluZd1kyvGbLRbjyuzxV/42lzuhwxLJ60ePNvj/+RY9zA06HynwUKLwdt4kDWxIBnEd4uvZNIAy6nH5IgFj/EHEjMIWGgX6VfAdhoosizv4cMc1jh43NhUWvCXcCHhS+M6x5OnZ38QTE/VQAU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=bLSALCge1zZq4QJrcSeiT2nBJX5uR6t+bKd4YBY7jwatnGAUEyps2O/wXg789v3XPJSqhFTk8AvF2aixc8SmhHqhNem2XdL4Ely871Pvut1ruJdACg3bwLNH5h8lB2+M/b3A1YqnNW27DzrFygxS/XggYC1NgoaqrXGCMJHIR2k= Received: by 10.65.44.5 with SMTP id w5mr6832225qbj.1194024115335; Fri, 02 Nov 2007 10:21:55 -0700 (PDT) Received: by 10.64.193.5 with HTTP; Fri, 2 Nov 2007 10:21:55 -0700 (PDT) Message-ID: <56a83cd00711021021u1e1019c1y42c29620c006397d@mail.gmail.com> Date: Fri, 2 Nov 2007 10:21:55 -0700 From: "David Van Couvering" Sender: david.vancouvering@gmail.com To: derby-dev@db.apache.org Subject: Re: Testing C.R.A.P. in Derby In-Reply-To: <472B3829.8080101@Sun.COM> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <472B3829.8080101@Sun.COM> X-Google-Sender-Auth: 76cfefbd48ad6d9a X-Virus-Checked: Checked by ClamAV on apache.org There's also a very good static analysis tool called FindBugs that we're using to great effect in NetBeans. See http://findbugs.sourceforge.net/ On Nov 2, 2007 7:46 AM, John Embretsen wrote: > Did you know there is a new tool in town that can detect CRAPpy Java code? > Are you interested in knowing more about Derby's code quality? Test coverage? > Code complexity? > > Well, I don't know if crap4j will help you much, but I just couldn't resist > trying it against the Derby code base... > > C.R.A.P. = "Change Risk Analyzer and Predictor", and is a "tool to help you > defend yourself against overly complex and untested code". > > The current formula for calculating CRAP is described at > http://www.artima.com/weblogs/viewpost.jsp?thread=215899 . In short, CRAP > measures the code complexity in your methods and runs your JUnit tests to > measure the test coverage of those methods. Test coverage can weigh up for code > complexity, which means that complex methods with no test coverage get a high > CRAP number. > > crap4j is an open source Java implementation of such a tool, and there's a > prototype available at http://www.crap4j.org. It is available as an Ant task or > an Eclipse plugin. I did a quick run of the Ant task using the attached > modifications to build.xml (your mileage may vary). > > The result was: > ---------------- > > Percentage of CRAPpy Methods 5.80 % > CRAP Load 23101 > Total Method Count 29300 > CRAPpy Method Count (CRAP > 30 ) 1698 > > > This crap4j run measured 5.80 % CRAPpy methods in Derby (trunk @ revision > 589902), which is just above the CRAP threshold of 5 %. Not bad ;) The HTML > reports include listings of methods sorted by CRAP, CRAP load, complexity and > coverage, but the files are quite big so I did not attach detailed results here. > > Please note that this was just an experimental run of crap4j, which (for > example) assumed that all classes ending with "Test" in the classes/ directory > were Junit tests (which is not entirely true). > > I'm just posting this in case others find this interesting and want to try it > out. And because it's a Friday, a suitable day for viewing things from a > slightly different perspective than usual. > > > -- > John > > > > > Index: build.xml > =================================================================== > --- build.xml (revision 590043) > +++ build.xml (working copy) > @@ -34,6 +34,18 @@ > > > > + > + > + > + > + > + > + > + > + > + > + > + > > > > @@ -1889,6 +1901,35 @@ > value="${derby.jar.base}/derbyTesting.jar:${derby.jar.base}/derbynet.jar:${derby.jar.base}/derbytools.jar:${derby.jar.base}/derbyclient.jar"/> > > > - > + > + > + > + > + + outputDir="crap4j/reports" > + dontTest="false" debug="false"> > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > > + > > > > >