From c46f068c84863cb9c9ce13392a94765d8e8facd4 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 16 Mar 2018 22:03:24 +1300 Subject: Further soften magic numbers Perl::Critic rule Include 1900 as an allowed integer, for performing logic with the "year" index of `localtime`/`gmtime`. The core module Time::Piece generally makes this unneeded; this change is for writing code that should work on very old releases of Perl (e.g. 5.6), where Time::Piece was not yet core. --- perlcritic/perlcriticrc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/perlcritic/perlcriticrc b/perlcritic/perlcriticrc index bc8453f8..91bc1540 100644 --- a/perlcritic/perlcriticrc +++ b/perlcritic/perlcriticrc @@ -17,7 +17,8 @@ add_exceptions = inet4 inet6 ipv4 ipv6 # This one causes more trouble than it's worth, too [-Documentation::RequirePODUseEncodingUTF8] -# Soften this policy a bit; tolerate all the single-digit integers as literals, -# and also three powers of 10 (for percentages, milliseconds etc) +# Soften this rather harsh policy a fair bit; tolerate negative one, all the +# single-digit integers as literals, three powers of 10 (for percentages, +# milliseconds etc), and 1900 (for localtime) [ValuesAndExpressions::ProhibitMagicNumbers] -allowed_values = 0..9 10 100 1000 +allowed_values = -1 0..9 10 100 1000 1900 -- cgit v1.2.3