CPANTS news

domm on 2004-10-08T19:26:14

I just released a new version of Module::CPANTS::Generator. Should be on your favourite CPAN mirror soon.

It contains the following new metrics:

  • proper_libs - is there only one .pm file in the top dir or one or more in libs
  • use_stric - do all modules in dist use strict
  • use warnings - do all modules in dist use warnings
The last two are generated by parsing the source code with a Parse::RecDescent based parser (Module::ExtractUse). This might be buggy, so please inform me if something got parsed wrong.

There's also quite a bit of new metadata, mainly a list of all modules actually used by a dist (again gathered by parsing). This information isn't used currently, but I plan to compare this list with what's specified in PREREQ_PM (minus Module::CoreList, of course).

Some data (total Kwalitee available is 14) (SQLite db is available here: ):

sqlite> select kwalitee,count(kwalitee) as cnt from kwalitee group by kwalitee order by kwalitee;
kwalitee    cnt       
----------  ----------
0           30        
2           3         
3           11        
4           57        
5           35        
6           34        
7           95        
8           276       
9           670       
10          1609      
11          2567      
12          1780      
13          747       
14          21        

+++++++++++++++++++++++++++

sqlite> select avg(kwalitee) from kwalitee;
avg(kwalitee)       
--------------------
10.7424070573409    

+++++++++++++++++++++++++++

sqlite> select cpanid,name,average_kwalitee from authors where distcount>5 order by average_kwalitee desc limit 20;
cpanid      name                       average_kwalitee
----------  -------------------------  ----------------
BPOSTLE     Bruno Postle               13              
STEPHANB    Stephan Buys               13              
JCDUQUE     Julius C. Duque            12.9411764705882
AMBS        Alberto Manuel Brandao Si  12.9            
IAN         Ian Langworth              12.7857142857143
BARBIE      Barbie                     12.75           
FABPOT      Fabien Potencier           12.7272727272727
RMCFARLA    Ross McFarland             12.7142857142857
BMORROW     Ben Morrow                 12.7142857142857
RSAVAGE     Ron Savage                 12.68           
RJBS        Ricardo SIGNES             12.5769230769231
SSCOTTO     Salvatore E. ScottoDiLuzi  12.5714285714286
COG         Jose' Alves de Castro      12.4615384615385
DAVECROSS   Dave Cross                 12.4375         
JOUKE       Jouke Visser               12.4285714285714
NKH         Nadim Ibn Hamouda El Khem  12.4285714285714
JFITZ       James FitzGibbon           12.4            
TSCH        Torsten Schoenfeld         12.3333333333333
CLOTHO      Clotho Advanced Media      12.3333333333333
FLORIAN     Florian Helmberger         12.3333333333333

+++++++++++++++++++++++++++

sqlite> select module,count(module) as cnt from uses group by module order by cnt desc limit 20; 
module                cnt                      
--------------------  -------------------------
strict                7026                     
vars                  4542                     
Carp                  3226                     
Exporter              3052                     
warnings              2255                     
DynaLoader            751                      
constant              747                      
5.006                 731                      
Data::Dumper          631                      
AutoLoader            503                      
POSIX                 381                      
File::Spec            341                      
IO::File              337                      
File::Basename        336                      
5.004                 321                      
DBI                   309                      
Fcntl                 294                      
5.005                 284                      
Apache::Constants     274                      
Cwd                   269 

Next steps:
  • Set up a proper cronjob (sorry Jos, you're butt-kick on #perl wasn't hard enough :-)
  • Set up something to automatically generate nice reports
  • add more metrics


use warnings;

nicholas on 2004-10-08T21:15:26

use warnings as a metric is unfair if a module expects to work with 5.005 or earlier. Likewise, having use warnings without a require 5.006 (or later) in Makefile.PL is probably a sign of poor kwalitee.

Re:use warnings;

domm on 2004-10-10T19:18:50

Hmm, you're right.

So I guess I'll drop use warnings as a metric, and maybe add a combined use warnings && require 5.006 check.

Re:use warnings;

brian_d_foy on 2004-10-10T22:37:24

This might be too much to do for every package, but I think checking for emitted warnings during tests might be a good metric. It's not perfect either, though.

Still, good work :)

Some oddities

brian_d_foy on 2004-10-08T22:14:47

It seems the "use strict" test doesn't work out right for Business::ISMN.

I'm curious how your system decides which modules to include: several of mine are missing, such as Chemistry::Elements, Apache::Htaccess, and Data::Constraint.

The "use warning" metric is a bit unfair. Not only does it not work with perl versions prior to 5.6, but some people don't want warnings on in production code lest a perl upgrade start dumping new warnings into logs files. Before disks got to be as big as they are today, one such instance filled up a disk overnight and crashed the server.

Re:Some oddities

domm on 2004-10-10T19:29:07

It seems the "use strict" test doesn't work out right for Business::ISMN.

You're right. Business::ISMN contains two module files, but defines three namespaces, all of which use strict. The bug in CPANTS is that it expects the number of use stricts to be the same as the number of module files. Which is obviously wrong. I changed '==' to '

I'm curious how your system decides which modules to include: several of mine are missing, such as Chemistry::Elements, Apache::Htaccess, and Data::Constraint.

Hmm, strange. I'm using CPANPLUS to fetch all dists from CPAN (or so I thought). I'll take a closer look ASAP.

See my reply to Nicholas on use warnings

Another possible metric?

runrig on 2004-10-12T00:42:20

I'm not sure exactly how to include it, but I think the CPAN ratings ought to be some sort of kwalitee indicator :-)