The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::Kwalitee::Extra - Run Kwalitee tests including optional indicators, especially, prereq_matches_use

VERSION

version v0.0.6

SYNOPSIS

  # Simply use, with excluding indicators
  use Test::Kwalitee::Extra qw(!has_example !metayml_declares_perl_version);

  # Use with eval guard, with excluding class
  use Test::More;
  eval { require Test::Kwalitee::Extra; Test::Kwalitee::Extra->import(qw(!:optional)); };
  plan( skip_all => "Test::Kwalitee::Extra not installed: $@; skipping") if $@;

  # Typically, this test is limited to author test or release test
  BEGIN { # limited to release test
    unless ($ENV{RELEASE_TESTING}) { # or $ENV{AUTHOR_TESTING} for author test
      require Test::More;
      Test::More::plan(skip_all => 'these tests are for release candidate testing');
    }
  }
  use Test::More;
  eval { require Test::Kwalitee::Extra; Test::Kwalitee::Extra->import(qw(!:optional)); };
  plan( skip_all => "Test::Kwalitee::Extra not installed: $@; skipping") if $@;

DESCRIPTION

CPANTS checks Kwalitee indicators, which is not quality but automatically-measurable indicators how good your distribution is. Module::CPANTS::Analyse calcluates Kwalitee but it is not directly applicable to your module test. CPAN has already had Test::Kwalitee for the test module of Kwalitee. It is, however, limited to 13 indicators from 34 indicators (core and optional), as of 1.01. Furthermore, Module::CPANTS::Analyse itself cannot calculate prereq_matches_use indicator. It is marked as needs_db, but only limited information is needed to calculate the indicator. This module calculate prereq_matches_use to query needed information to MetaCPAN.

Currently, 18 core indicators and 8 optional indicators are available in default configuration. See "INDICATORS" section.

OPTIONS

You can specify including or excluding an indicator or a tag like Exporter. Valid tags are core, optional and experimental. For indicators, see Module::CPANTS::Analyse.

Please NOTE that to specify tags are handled a bit differently from Exporter. First, specifying an indicator is always superior to specifying tags, even though specifying an indicator is prior to specifying tags. For example,

  use Test::Kwalitee::Extra qw(!has_example :optional);

!has_example is in effect, that is has_exaple is excluded, even though has_example is an optional indicator.

Second, default excluded indicators mentioned in "INDICATORS" section are not included by specifying tags. For example, in the above example, :optional does not enable is_prereq and metayml_conforms_spec_current. You can override it by explicitly specifying the indicator:

  use Test::Kwalitee::Extra qw(metayml_conforms_spec_current);

SPECIAL TAGS

Some tags have special meanings.

:no_plan

If specified, do not call Test::Builder::plan. You may need to specify it, if this test is embedded into other tests.

:minperlver <version>

prereq_matches_use indicator ignores core modules. What modules are in core, however, is different among perl versions. If minimum perl version is specified in META.yml or such a meta information, it is used as minimum perl version. Otherewise, $], the version of the current perl interpreter, is used.

If specified, this option overrides them.

INDICATORS

In Module::CPANTS::Analyse, prereq_matches_use requires CPANTS DB setup by Module::CPANTS::ProcessCPAN. is_prereq really requires information of prereq of other modules but prereq_matches_use only needs mappings between modules and dists. So, this module query the mappings to MetaCPAN by using MetaCPAN::API::Tiny.

For default configuration, indicators are treated as follows:

Available indicators in core
  • has_readme

  • has_manifest

  • has_meta_yml

  • has_buildtool

  • has_changelog

  • no_symlinks

  • has_tests

  • buildtool_not_executable

  • metayml_is_parsable

  • metayml_has_license

  • proper_libs

  • no_pod_errors

  • has_working_buildtool

  • has_better_auto_install

  • use_strict

  • valid_signature

  • has_humanreadable_license

  • no_cpants_errors

Available indicators in optional
  • has_tests_in_t_dir

  • has_example

  • no_stdin_for_prompting

  • metayml_declares_perl_version

  • prereq_matches_use

  • use_warnings

  • has_test_pod

  • has_test_pod_coverage

Excluded indicators in core
Can not apply already unpacked dist
  • extractable

  • extracts_nicely

  • has_version

  • has_proper_version

Already dirty in test phase
  • fest_matches_dist

  • no_generated_files

Broken in Module::CPANTS::Analyse 0.86 rt.cpan.org #80225
  • metayml_conforms_to_known_spec

Excluded indicators in optional
Needs CPANTS DB
  • is_prereq

Broken in Module::CPANTS::Analyse 0.86 rt.cpan.org #80225
  • metayml_conforms_spec_current

SEE ALSO

AUTHOR

Yasutaka ATARASHI <yakex@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Yasutaka ATARASHI.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.