Skip Menu |

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

Report information
The Basics
Id: 100292
Status: open
Priority: 0/
Queue: Perl-Critic-Pulp

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

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



Subject: CodeLayout::RequireTrailingCommaAtNewline - suggest excluding single-element lists, or here documents
CodeLayout::RequireTrailingCommaAtNewline is a useful policy but it might make more sense for it only to fire on lists of two or more elements. Alternatively it could avoid suggesting adding a comma after a 'here document', which gets awkward. Otherwise you get warnings for code like $dbh->prepare(<<END some sql statement goes here... END ); Admittedly not very pretty code, but it wouldn't be improved by adding a trailing comma.
CC: bug-Perl-Critic-Pulp [...] rt.cpan.org
Subject: Re: [rt.cpan.org #100292] CodeLayout::RequireTrailingCommaAtNewline - suggest excluding single-element lists, or here documents
Date: Thu, 13 Nov 2014 19:15:17 +1100
To: EDAVIS [...] cpan.org
From: Kevin Ryde <user42_kevin [...] yahoo.com.au>
"EDAVIS via RT" <bug-Perl-Critic-Pulp@rt.cpan.org> writes: Show quoted text
> > it might make more sense for it only to fire on lists of two or more > elements.
Do you have an example of a one-element where it should not? Or just the here-document? Show quoted text
> Otherwise you get warnings for code like > > $dbh->prepare(<<END > some sql statement > goes here... > END > );
Yes that should be feasible, reckoning a newline after <<END as collapsed. I imagine it's slightly more usual to do something like below, though I see "inline" would have merit if doing a list of here documents. $dbh->prepare(<<END); some sql statement goes here... END
I think the here-document is the most common case. Yes, you can move the content to the end of the statement but that is not preferred by everyone. (I think I grew to put the here-document in the middle of the parentheses because otherwise emacs gets confused.)
Subject: Re: [rt.cpan.org #100292] CodeLayout::RequireTrailingCommaAtNewline - suggest excluding single-element lists, or here documents
Date: Sun, 04 Jan 2015 18:00:29 +1100
To: "EDAVIS via RT" <bug-Perl-Critic-Pulp [...] rt.cpan.org>
From: Kevin Ryde <user42_kevin [...] yahoo.com.au>
"EDAVIS via RT" <bug-Perl-Critic-Pulp@rt.cpan.org> writes: Show quoted text
> > I think the here-document is the most common case.
I added a bit to version 89 allowing the single expression form I thought seemed reasonable. I might yet be tempted to make an option for it or other styles. Show quoted text
> (I think I grew to put the here-document in the middle of > the parentheses because otherwise emacs gets confused.)
cperl-mode is usually quite good. Sometimes it needs a re-visit to the file to work out "hard" constructs.
Sorry I see now that I forgot about this bug and opened #102545 as well.