NAME

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

VERSION

version v0.4.0

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 $@;

# Avoid network access
use Test::Kwalitee::Extra qw(!prereq_matches_use);
# or, when experimental enabled
use Test::Kwalitee::Extra qw(:experimental !prereq_matches_use !build_prereq_matches_use);

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, impossible to calculate prereq_matches_use indicator, because dependent module Module::CPANTS::Analyse itself cannot calculate prereq_matches_use indicator. It is marked as needs_db which means pre-calculated module database is necessary, but only limited information is needed to calculate the indicator. This module calculate prereq_matches_use to query needed information to MetaCPAN site online.

For available indicators, 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_example 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. You can override it by explicitly specifying the indicator:

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

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.

:retry <count>

The number of retry to query to MetaCPAN. This is related with prereq_matches_use and build_prereq_matches_use indicators only.

Defaults to 5.

CAVEATS

An optional indicator prereq_matches_use and an experimental indicator build_prereq_matches_use require HTTP access to MetaCPAN site. If you want to avoid it, you can specify excluded indicators like

# Avoid network access
use Test::Kwalitee::Extra qw(!prereq_matches_use);

# or, when experimental enabled
use Test::Kwalitee::Extra qw(:experimental !prereq_matches_use !build_prereq_matches_use);

Or mitigate wait by tentative failures to reduce retry counts like

# Try just one time for each query
use Test::Kwalitee::Extra qw(:retry 1);

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::Client.

Recently, Module::CPANTS::Analyse has been changed much. For actual available indicators, please consult Module::CPANTS::Kwalitee::* documentation. For default configuration, indicators are treated as follows:

NOTES
(+)

No longer available for Module::CPANTS::Analyse 0.88 or 0.90+.

(++)

No longer available for Module::CPANTS::Analyse 0.90+.

(+++)

No longer available for Module::CPANTS::Analyse 0.88 or 0.90+, moved to Module::CPANTS::SiteKwalitee.

(++++)

No longer available for Module::CPANTS::Analyse 0.88 or 0.90+, moved to Module::CPANTS::SiteKwalitee but supported by this module.

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 (optional for 0.88 or 0.90+)

  • metayml_conforms_to_known_spec

  • proper_libs (for 0.87 or 0.89)

  • no_pod_errors (+)

  • has_working_buildtool (+)

  • has_better_auto_install (+)

  • use_strict

  • valid_signature (+++)

  • has_humanreadable_license (for 0.87 or 0.89) | has_human_redable_license (for 0.88 or 0.90+)

  • no_cpants_errors (+)

Available indicators in optional
  • has_tests_in_t_dir

  • has_example (+)

  • no_stdin_for_prompting

  • metayml_conforms_spec_current

  • 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
  • manifest_matches_dist

  • no_generated_files (++)

Excluded indicators in optional
Can not apply already unpacked dist
  • proper_libs (for 0.88 or 0.90+)

Needs CPANTS DB
  • is_prereq (+++)

Indicators with special note in experimental
  • build_prereq_matches_use (++++)

SEE ALSO

AUTHOR

Yasutaka ATARASHI <yakex@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 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.