Some false positives
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libperl-critic-perl (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
With this file:
https:/
I get some false positives:
pierre@
Close filehandles as soon as possible after opening them at line 16, column 8. See page 209 of PBP. (Severity: 4)
File handle for "print" or "printf" is not braced at line 37, column 17. See page 217 of PBP. (Severity: 1)
I can't close the file handle sooner or it won't work.
And $space is not a file handle so it does not need to be braced.
ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: libperl-critic-perl 1.117-2
ProcVersionSign
Uname: Linux 3.5.0-19-generic i686
ApportVersion: 2.6.1-0ubuntu6
Architecture: i386
Date: Tue Dec 4 20:21:41 2012
MarkForUpload: True
PackageArchitec
SourcePackage: libperl-critic-perl
UpgradeStatus: Upgraded to quantal on 2012-10-25 (40 days ago)
On Tue, 04 Dec 2012 19:25:08 -0000, Pierre Rudloff wrote:
> With this file: /svn.strasweb. fr/dl.php? repname= Pierre+ Rudloff& path=%2Fperl% 2FLatexRudloff. pl&rev= 46 pierre- MacBook: /var/www/ svn-rudloff/ perl$ perlcritic --brutal LatexRudloff.pl
> https:/
> I get some false positives:
> pierre@
> Close filehandles as soon as possible after opening them at line 16, column 8. See page 209 of PBP. (Severity: 4)
> File handle for "print" or "printf" is not braced at line 37, column 17. See page 217 of PBP. (Severity: 1)
>
> I can't close the file handle sooner or it won't work.
> And $space is not a file handle so it does not need to be braced.
I just tried to run
% perlcritic --brutal --verbose 11 LatexRudloff.pl
to get more info.
As for the first issue, the diagnostic output says:
This policy takes note of calls to `open()' where there is no matching
`close()' call within `N' lines of code. If you really need to do a lot
of processing on an open filehandle, then you can move that processing
to another method like this: [..]
For the second one, `perldoc -f print' is interesting:
(NOTE: If
FILEHANDLE is a variable and the next token is a term, it may be misinterpreted as an operator unless you
interpose a "+" or put parentheses around the arguments.)
What seems to work is
. $space
. $numsec . q{.}
. $numsubsec . q{.}
. $numsubsubsec
. $dot
. $1 . "\n" )
Cheers,
gregor
-- info.comodo. priv.at/ - OpenPGP key 0xBB3A68018649AA06 www.debian. org/
.''`. Homepage: http://
: :' : Debian GNU/Linux user, admin, and developer - http://
`. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
`- NP: Die Schmetterlinge: Hände über Hönnepel