The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

CPAN::Changes::Cwalitee - Calculate the cwalitee of your CPAN Changes file

VERSION

This document describes version 0.009 of CPAN::Changes::Cwalitee (from Perl distribution CPAN-Changes-Cwalitee), released on 2019-08-02.

SYNOPSIS

 use CPAN::Changes::Cwalitee qw(
     calc_cpan_changes_cwalitee
     list_cpan_changes_cwalitee_indicators
 );

 my $res = calc_cpan_changes_cwalitee(
     path => 'Changes',
 );

DESCRIPTION

What is CPAN Changes cwalitee? A metric to attempt to gauge the quality of your CPAN Changes file. Since actual quality is hard to measure, this metric is called a "cwalitee" instead. The cwalitee concept follows "kwalitee" [1] which is specifically to measure the quality of CPAN distribution. I pick a different spelling to avoid confusion with kwalitee. And unlike kwalitee, the unqualified term "cwalitee" does not refer to a specific, particular subject. There can be "CPAN Changes cwalitee" (which is handled by this module), "module abstract cwalitee", and so on.

INTERNAL NOTES

Indicator priority. At priority 10, Changes file is parsed using CPAN::Changes and the result # it put in 'parsed' key.

FUNCTIONS

calc_cpan_changes_cwalitee

Usage:

 calc_cpan_changes_cwalitee(%args) -> [status, msg, payload, meta]

This function is not exported by default, but exportable.

Arguments ('*' denotes required arguments):

  • exclude_indicator => array[str]

    Do not use these indicators.

  • exclude_indicator_module => array[perl::modname]

    Do not use indicators from these modules.

  • exclude_indicator_status => array[str]

    Do not use indicators having these statuses.

  • include_indicator => array[str]

    Only use these indicators.

  • include_indicator_module => array[perl::modname]

    Only use indicators from these modules.

  • include_indicator_status => array[str] (default: ["stable"])

    Only use indicators having these statuses.

  • min_indicator_severity => uint (default: 1)

    Minimum indicator severity.

  • path* => pathname

    Use - to read from STDIN.

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (payload) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

list_cpan_changes_cwalitee_indicators

Usage:

 list_cpan_changes_cwalitee_indicators(%args) -> [status, msg, payload, meta]

Examples:

  • List all installed indicators from all modules:

     list_cpan_changes_cwalitee_indicators();

    Result:

     [
       "date_correct_format",
       "date_parsable",
       "english",
       "has_releases",
       "no_duplicate_version",
       "no_empty_group",
       "no_shouting",
       "no_useless_text",
       "not_too_wide",
       "parsable",
       "preamble_has_no_releases",
       "release_dates_not_future",
       "releases_in_descending_date_order",
     ]
  • List only certain names, show details:

     list_cpan_changes_cwalitee_indicators(
       detail  => 1,
       include => ["parsable", "date_parsable", "date_correct_format"]
     );

    Result:

     [
       {
         module   => "CPAN::Changes::Cwalitee::Core",
         name     => "date_correct_format",
         priority => 50,
         severity => 3,
         status   => "stable",
         summary  => "Dates are specified in the correct specified format, e.g. YYYY-MM-DD",
       },
       {
         module   => "CPAN::Changes::Cwalitee::Core",
         name     => "date_parsable",
         priority => 50,
         severity => 3,
         status   => "stable",
         summary  => "Dates are parsable by CPAN::Changes",
       },
       {
         module   => "CPAN::Changes::Cwalitee::Core",
         name     => "parsable",
         priority => 10,
         severity => 3,
         status   => "stable",
         summary  => "Parseable by CPAN::Changes",
       },
     ]

This function is not exported by default, but exportable.

Arguments ('*' denotes required arguments):

  • detail => bool

  • exclude => array[str]

    Exclude by name.

  • exclude_module => array[perl::modname]

    Exclude by module.

  • exclude_status => array[str]

    Exclude by status.

  • include => array[str]

    Include by name.

  • include_module => array[perl::modname]

    Include by module.

  • include_status => array[str] (default: ["stable"])

    Include by status.

  • max_severity => int (default: 5)

    Maximum severity.

  • min_severity => int (default: 1)

    Minimum severity.

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (payload) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/CPAN-Changes-Cwalitee.

SOURCE

Source repository is at https://github.com/perlancar/perl-CPAN-Changes-Cwalitee.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=CPAN-Changes-Cwalitee

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

[1] https://cpants.cpanauthors.org/

App::CPANChangesCwaliteeUtils for the CLI's.

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019 by perlancar@cpan.org.

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