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: 38674
Status: resolved
Priority: 0/
Queue: Perl-Critic

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

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



Subject: How do you assign future rule exceptions in .perlcriticrc?
Test-Simple has a project-wide .perlcriticrc now. I'm using some bleeding-edge policy options now such as: # "no warnings" is fine as long as it's restricted to one or # more categories [TestingAndDebugging::ProhibitNoWarnings] allow_with_category_restriction = 1 # Don't need /x on small regexes. [RegularExpressions::RequireExtendedFormatting] minimum_regex_length_to_complain_about = 12 Unfortunately, perlcritic fails if it sees an option it doesn't understand. This makes it difficult to use new policies and options in a project-wide policy. Is there a way to turn the policy check off so it ignores any options it does not understand? If not, could a .perlcriticrc setting be added?
Subject: Re: [rt.cpan.org #38674] How do you assign future rule exceptions in .perlcriticrc?
Date: Fri, 22 Aug 2008 17:16:18 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
Michael G Schwern via RT wrote: Show quoted text
> Unfortunately, perlcritic fails if it sees an option it doesn't > understand. This makes it difficult to use new policies and options in > a project-wide policy.
I don't understand. Either you want something to be enforced for a project or you don't. Can you elaborate further on what you want?
Subject: Re: [rt.cpan.org #38674] How do you assign future rule exceptions in .perlcriticrc?
Date: Fri, 22 Aug 2008 15:56:30 -0700
To: bug-Perl-Critic [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
Elliot Shank via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=38674 > > > Michael G Schwern via RT wrote:
>> Unfortunately, perlcritic fails if it sees an option it doesn't >> understand. This makes it difficult to use new policies and options in >> a project-wide policy.
> > I don't understand. Either you want something to be enforced for a project or you don't. Can you elaborate further on what you want?
perlcritic will error out if it sees a policy or policy option it does not recognize. Let's say there's a brand new option in a Perl::Critic::Policy. [1] I want to use that option for my project. So I upgrade Perl::Critic, I add the new option to the project's .perlcriticrc and go. Other people in the project might also run perlcritic, but they might not have the latest and greatest Perl::Critic. They try to run perlcritic and get an error about an unknown policy option. So in order to use new policies and options, the whole project has to keep Perl::Critic in sync. It would be nice if I could make perlcritic less fussy and have it ignore any policies and options it doesn't recognize so we can get some sort of result. An option in the .perlcriticrc, for example. You can see an example here, where I've had to comment out all the policy improvements I've been making because they'll only work if you have Perl::Critic trunk. That means nobody can use them, updated Perl::Critic or not. http://code.google.com/p/test-more/source/browse/trunk/.perlcriticrc [1] At the rate I've been patching, this would be an unreleased trunk version. -- The past has a vote, but not a veto. -- Mordecai M. Kaplan
Subject: Re: [rt.cpan.org #38674] How do you assign future rule exceptions in .perlcriticrc?
Date: Fri, 22 Aug 2008 20:47:45 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
Michael G Schwern via RT wrote: Show quoted text
> Elliot Shank via RT wrote:
>> I don't understand. Either you want something to be enforced for a >> project or you don't. Can you elaborate further on what you want?
Show quoted text
> Let's say there's a brand new option in a Perl::Critic::Policy. [1] > I want to use that option for my project. So I upgrade Perl::Critic, > I add the new option to the project's .perlcriticrc and go. > > Other people in the project might also run perlcritic, but they might > not have the latest and greatest Perl::Critic. They try to run > perlcritic and get an error about an unknown policy option. > > So in order to use new policies and options, the whole project has to > keep Perl::Critic in sync. It would be nice if I could make > perlcritic less fussy and have it ignore any policies and options it > doesn't recognize so we can get some sort of result. An option in > the .perlcriticrc, for example.
Aha. Ok, you're thinking of different usage than I am. When I think of a project rc file, I'm thinking of usage with Test::P::C. If you're doing that, then you want to force everybody to upgrade because there's no point to the test if everyone doesn't have to comply with it. Given your usage, I can see your point. There's already a "profile-strictness" option. Add "profile-strictness = quiet" to your rc file. This will stop complaints about non-existent policies. However, it doesn't extend to policy options currently. We can make it do so.
CC: mschwern [...] cpan.org
Subject: Re: [rt.cpan.org #38674] How do you assign future rule exceptions in .perlcriticrc?
Date: Fri, 22 Aug 2008 19:42:19 -0700
To: bug-Perl-Critic [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
Elliot Shank via RT wrote: Show quoted text
> There's already a "profile-strictness" option. Add "profile-strictness = quiet" to your rc file. > This will stop complaints about non-existent policies. However, it doesn't
extend to policy Show quoted text
> options currently. We can make it do so.
That would be very handy, thank you. -- If at first you don't succeed--you fail. -- "Portal" demo
On Fri Aug 22 22:43:17 2008, schwern@pobox.com wrote: Show quoted text
> Elliot Shank via RT wrote:
> > There's already a "profile-strictness" option. Add "profile-
> strictness = quiet" to your rc file.
> > This will stop complaints about non-existent policies. However, it
> doesn't > extend to policy
> > options currently. We can make it do so.
> > That would be very handy, thank you. > >
I was just mucking around in the relevant modules - why don't I take a shot at this? Tom Wyant
Proposed implementation committed as revision 3102. Tied the handling of unrecognized policy configuration items to profile_strictness. Because the default profile_strictness is 'warn', they are now warnings. Before, they were fatal. Eliminated a test from t/01_config_bad_perlcriticrc.t that assumed unknown policy configuration items were fatal, but forced this behavior in t/14_policy_parameters.t by instantiating the policy factory with '-profile-strictness' => 'fatal'.
This has been completed and released in Perl-Critic-1.097_002. http://search.cpan.org/~elliotjs/Perl-Critic-1.097_002 Thank you for submitting this ticket.