Improve your (Perl) code Kwalitee

Posted: December 29th, 2007 | Author: | Filed under: Coding Tips | No Comments »

If you are a Perl developer you may have come across CPANTS which analyses and ranks all distributions and authors on CPAN based on their Kwalitee score. To quote…

  What is a good module? That's hard to say.

  What is good code? That's also hard to say.

  "Quality" is not a well-defined term in computing ... and especially not Perl.

  One man's Thing of Beauty is another's man's Evil Hack

  Since we can't define quality, how do we write a program to assure it?

Kwalitee: It looks like quality, it sounds like quality, but it’s not quite quality.

I was rather disappointed to discover my own Kwalitee scores were rather poor so have been spending time to improve matters. The key to this is to run a test to check the Kwalitee score of a new release before uploading it to CPAN. Conveniently the very code used to generate the rankings is available to download and run offline in the form of the Module-CPANTS-Analyse. Inconveniently this wasn’t in Fedora…until today. I finally got all the dependent modules through review and built for rawhide, with F-8 to follow shortly… So now if you want to test the Kwalitee of your Perl modules before release just run:

# yum install perl-Module-CPANTS-Analyse
# cpants_lint.pl /path/to/my/module.tar.gz

It already helped me get Test-AutoBuild perfect…

$ cpants_lint.pl Test-AutoBuild-1.2.2.tar.gz
Checked dist            Test-AutoBuild-1.2.2.tar.gz
Kwalitee rating         112.50% (27/24)

Congratulations for building a 'perfect' distribution!

112.50% you might wonder ? Yes, indeed. Only 24 of the checks are considered mandatory at this time. The other 3 are optional, but good practice none-the-less. To get to 100% you need to pass all the mandatory checks. If you manage this, then passing any optional checks will give you an additional boost.

Leave a Reply





Spam protection: Sum of thr33 plus f1ve ?: