Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Perl-Critic CPAN distribution.

Report information
The Basics
Id: 36206
Status: rejected
Priority: 0/
Queue: Perl-Critic

People
Owner: Nobody in particular
Requestors: EDAVIS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: ValuesAndExpressions::ProhibitMagicNumbers: allow -1
ValuesAndExpressions::ProhibitMagicNumbers is a useful policy, but if it allows 1 and 2 as literal values it should also allow -1 and -2. -1 is particularly needed for testing the result of index().
Subject: Re: [rt.cpan.org #36206] ValuesAndExpressions::ProhibitMagicNumbers: allow -1
Date: Tue, 27 May 2008 07:31:32 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
EDAVIS via RT wrote: Show quoted text
> ValuesAndExpressions::ProhibitMagicNumbers is a useful policy, but if it > allows 1 and 2 as literal values it should also allow -1 and -2. > > -1 is particularly needed for testing the result of index().
Not allowing 1 is not exactly an option. And you can't treat negative and positive values the same-- they have very different significance to people. I think 2 is used a lot more than -2 is. Anyway, this is why the module is configurable. If you want -1 and -2 to be allowed, configure them to be.
Subject: Re: [rt.cpan.org #36206] ValuesAndExpressions::ProhibitMagicNumbers: allow -1
Date: Tue, 27 May 2008 07:33:14 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Chris Dolan <chris [...] chrisdolan.net>
On May 27, 2008, at 4:08 AM, EDAVIS via RT wrote: Show quoted text
> Tue May 27 05:08:31 2008: Request 36206 was acted upon. > Transaction: Ticket created by EDAVIS > Queue: Perl-Critic > Subject: ValuesAndExpressions::ProhibitMagicNumbers: allow -1 > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: EDAVIS@cpan.org > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=36206 > > > > ValuesAndExpressions::ProhibitMagicNumbers is a useful policy, but > if it > allows 1 and 2 as literal values it should also allow -1 and -2. > > -1 is particularly needed for testing the result of index().
This policy is already configurable. See its documentation for how to set your own list of allowed numbers. Chris
I agree that the configuration should suffice in this case.