CPANTS news

domm on 2007-10-30T21:16:40

(Crossposted from )

The view for a dist is now broken up into several subpages. This makes the data more easy to read. I've also fixed some minor problems in the list of prereqs etc (links are now going to the dist each module is in).

I've added a new metric: use_warnings. This metric checks if all of your modules include a line like 'use warnings;'. As this does not work for old Perls, I've made it an optional metric (for now..).

A patch submitted by Adriano Ferreira enhances MANIFEST-checking (and removes a bug caused by chdir). See RT #28982 for details.

Andy Armstrong suggested to also look in xt/ for tests, because this is becoming the new place for optional author tests (like pod-coverage). Which I implemented...

The META.yml checks submitted by Barbie turn up a lot of interesting results:

  • Module::Install creates META.yml files that do not conform to the spec, because the author field has to be a list (but Module::Install creates it as a string)
  • There seems to be a problem with version numbers with a 'v' (as in 'v1.42') in prereq (but this might be a problem of the testing code?)
  • Currently, 10550 of 13145 dists do not come with a valid META.yml. That means that only 20% of the META.yml files conform to the spec (or CPANTS is too strict...)

I've also re-analysed all of CPAN. The only thing left to do now (besides adding more metrics) is to make the various graphs work again...


Keep the strict META.yml check

Alias on 2007-10-30T23:48:05

After all, it's things like this that CPANTS was created for in the first place.

Re:Keep the strict META.yml check

BinGOs on 2007-10-31T08:41:25

SO, does this mean you'll fix Module::Install?

My naive attempts at fixing it myself broke it even more >=(

Re:Keep the strict META.yml check

barbie on 2007-10-31T10:01:52

I'd second this view.

If you aren't going to have a strict conformance to the spec, then there is little point in having the checks at all.

With more requests to add metadata to the spec, if you want people to have confidence in the META.yml bundled with distributions, then authors need to be made aware of the areas that they don't conform. CPANTS is the ideal place for that.

Make use warnings a full kwalitee point

Alias on 2007-10-30T23:53:50

Here's what I'd recommend doing.

Firstly, you need a new "has_perl_version" test.

This would check that the distribution explicitly declares (presumably in it's META.yml) the version of perl that the distribution depends on.

Secondly, once you have that in place, make the use warnings logic something like...

if ( dist needs 5.6+ ) {
    if ( has_warnings ) {
        return pass;
    } else {
        return fail;
    }
} else {
    return pass;
}
That is, you should only fail the use warnings kwalitee metric IF you can guarantee the 100% of the userbase can handle use warnings.

(and we've needed the has_perl_version metric for a while anyways)

use_warnings Failures

barbie on 2007-10-31T09:56:37

I think you may want to revise the code for checking use_warning. CPANTS fails Finance::Currency::Convert::XE, but 'use warnings' is right there on line 5 and has been since it existed! It's the only module in the distribution, so it isn't referencing something else. However, this also raised a thought about whether you check modules under the /t (or /xt) directories. Some of those modules may not have 'use warnings' for a good reason in order to test aspects of the distribution.

Re:use_warnings Failures

domm on 2007-10-31T10:52:36

The code is ok, as it only checks .pm files in either the basedir, or in lib. If there are no modules in these places, CPANTS locates all .pm files, but skips x?t, test and inc paths.

In this case the problem is that CPANTS didn't pick up the correct CPANTS yaml file. Instead of using the correct one (of 0.14, btw), it used an outdated yaml file left over from a CPANTS run where the 'use_warnings' metric wasn't even implemented.

So, yes, there is a bug in CPANTS, but not in 'use_warnings'. I'll try to fix it in the next few days and hope that you can live without this point for the time beeing :-)

Re:use_warnings Failures

domm on 2007-11-07T19:07:45

Fixed in the current version of cpants. New data is online, also.

This distribution passes all CPANTS tests. Yay!

(using use.perl as a bugtracker)++

No Love for Moose

perigrin on 2007-10-31T13:37:05

Moose enables warnings and strict automagically (they're turned on via Moose's import), Test::Kwalitee already dislikes this so I have to (redundantly) add use strict; to everything ... are you saying I'm gonna get my CPANTS score docked now too cause I don't add a redundant use warnings; as well?

Re:No Love for Moose

jrockway on 2007-11-01T15:20:18

Who cares about your CPANTS score though? I look at it to see if I stupidly forgot something, not to see if I have a good score.

"use warnings" is a dumb metric because it has a runtime performance hit. If I use it during development (or make test), that's one thing... but imposing it on users of the CPAN module is not necessarily a good thing.

I do it anyway, out of laziness, but it's not necessarily a good idea.