jonasbn > Perl-Critic-Policy-logicLAB-RequireVersionFormat-0.07 > Perl::Critic::Policy::logicLAB::RequireVersionFormat

Download:
Perl-Critic-Policy-logicLAB-RequireVersionFormat-0.07.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.07   Source  

NAME ^

Perl::Critic::Policy::logicLAB::RequireVersionFormat - assert version number formats

AFFILIATION ^

This policy is part of Perl::Critic::logicLAB distribution.

VERSION ^

This documentation describes version 0.05

DESCRIPTION ^

This policy asserts that a specified version number conforms to a specified format.

The default format is the defacto format used on CPAN. X.X and X.X_X where X is an arbitrary integer, in the code this is expressed using the following regular expression:

    \A\d+\.\d+(_\d+)?\z

The following example lines would adhere to this format:

Scope, quoting and representation does not matter. If the version specification is lazy please see "EXCEPTIONS".

The following example lines would not adhere to this format and would result in a violation.

In addition to the above examples, there are variations in quoting etc. all would cause a violation.

EXCEPTIONS

In addition there are some special cases, were we simply ignore the version, since we cannot assert it in a reasonable manner.

CONFIGURATION AND ENVIRONMENT ^

strict_quotes

Strict quotes is off by default.

Strict quotes enforces that you version number must be quoted, like so: '0.01' and "0.01". 0.01 would in this case cause a violation. This would also go for any additional formats you could configure as valid using the "formats" parameter below.

    [logicLAB::RequireVersionFormat]
    strict_quotes = 1

ignore_quotes

Ignore quotes is on by default.

0.01, '0.01' and "0.01" would be interpreted as the same.

Disabling ignore quotes, would mean that: '0.01' and "0.01" would violate the default format since quotes are not specifed as part of the pattern. This would also go for any additional formats you could configure as valid using the "formats" parameter below.

    [logicLAB::RequireVersionFormat]
    ignore_quotes = 0

formats

If no formats are specified, the policy only enforces the default format mentioned in "DESCRIPTION" in combination with the above two configuration parameters of course.

    [logicLAB::RequireVersionFormat]
    formats = \A\d+\.\d+(_\d+)?\z || \Av\d+\.\d+\.\d+\z

DEPENDENCIES AND REQUIREMENTS ^

INCOMPATIBILITIES ^

This distribution has no known incompatibilities.

BUGS AND LIMITATIONS ^

I think it would be a good idea to ignore this particular version string and versions thereof:

    our ($VERSION) = '$Revision$' =~ m{ \$Revision: \s+ (\S+) }x;

I am however still undecided.

BUG REPORTING ^

Please use Requets Tracker for bug reporting:

        http://rt.cpan.org/NoAuth/Bugs.html?Dist=Perl-Critic-logicLAB-Prohibit-RequireVersionFormat

TEST AND QUALITY ^

The following policies have been disabled for this distribution

TEST COVERAGE

    ---------------------------- ------ ------ ------ ------ ------ ------ ------
    File                           stmt   bran   cond    sub    pod   time  total
    ---------------------------- ------ ------ ------ ------ ------ ------ ------
    ...B/RequireVersionFormat.pm   97.9   75.0   68.2  100.0  100.0  100.0   89.8
    Total                          97.9   75.0   68.2  100.0  100.0  100.0   89.8
    ---------------------------- ------ ------ ------ ------ ------ ------ ------

TODO ^

SEE ALSO ^

AUTHOR ^

LICENSE AND COPYRIGHT ^

Copyright (c) 2009-2014 Jonas B. Nielsen. All rights reserved.

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

syntax highlighting: