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

People
Owner: Nobody in particular
Requestors: martin [...] hybyte.com
Cc:
AdminCc:

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



Subject: feature requests
Date: Thu, 27 Jul 2006 12:20:29 +0100
To: bug-Perl-Critic [...] rt.cpan.org
From: Martin Friebe <martin [...] hybyte.com>
Download (untitled) / with headers
text/plain 542b
Below a couple of maybe useful policies: Trailing spaces on the end of a line (or lines containing nothing but spaces) are usually not needed. In some editors they get highlighted (and look ugly). In others they are an annoyance when trying to jump to the end of line. Forbid inlining: HTML, SQL or other non perl constructs should be collected on top/bottom of the file (or in an external file). Inlining them with your perl code, decreases readability. Inlining as simple quoted string, (instead of in-here-doc) is the worst case.
Subject: feature requests: ProhibitTrailingSpace and ProhibitInlining
From: CLOTHO [...] cpan.org
Download (untitled) / with headers
text/plain 771b
On Thu Jul 27 07:21:38 2006, martin@hybyte.com wrote: Show quoted text
> Below a couple of maybe useful policies: > > Trailing spaces on the end of a line
This one falls under the umbrella of the existing policy CodeLayout::RequireTidyCode. That said, perhaps we could break out simple enforcement like the above idea. We already have CodeLayout::ProhibitHardTabs after all. Show quoted text
> Forbid inlining
Great idea! The Heredoc restriction should be easy to implement, but the quoted string will be harder to detect. Do you think we should just flag strings that are too long? Hmm... Perhaps we should also detect the use of (say) Inline::C or Mason and disable this policy if "use" statements with one of those modules are found? Or should this policy be strict and disallow even those?
Subject: Re: [rt.cpan.org #20714] feature requests: ProhibitTrailingSpace and ProhibitInlining
Date: Thu, 27 Jul 2006 15:19:49 +0100
To: bug-Perl-Critic [...] rt.cpan.org
From: Martin Friebe <martin [...] hybyte.com>
 via RT wrote: Show quoted text
  
Forbid inlining
    
Great idea!  The Heredoc restriction should be easy to implement, but
the quoted string will be harder to detect.  Do you think we should just
flag strings that are too long?  Hmm...

  
In the end, this is true, any string that is too long will disturb the syntax layout..

it his ok in a method with no (or almost no) other code, like

sub print_help {
Show quoted text
# possible an error msg ?
   my $err = shift;
   print <<"EOT";
foo bar
$err
option
option
....
EOT


That means 2 things to look at:
1) context

allowed in:
 - global defination, in package context
 - use constant
 - Class:DBI like __PACKAGE__->set_sql()
 - subroutine with no or limited perl code. (max statements / complexity <3 / percentage ??? no idea)
  maybe just allow as last statement / return value

all other contents are disallowed

definitions can either occur:
- before each sub declaration
- in one single location [ hard to test ]

any violating string or in-here-doc can be identified by pattern match.

.{40} => any strinfg longer than 40
^\s+(select|delete|update) => most common SQL

I don't thing there is a need to but to many patterns into the module.

Users can specify their own patterns in the config, if the need specific cases. In that case, it could be useful to specify the allowed context per pattern (and maybe even the wanted occurance)


Ok, that is now truly a big feature request....









Download (untitled) / with headers
text/plain 105b
I've documented these requests in TODO.pod. Leaving this bug open until they are implemented. -- Chris
From: perl [...] galumph.com
Just submitted CodeLayout::ProhibitTrailingWhitespace, so the simple half of the request is done.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.