Skip Menu |

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

Report information
The Basics
Id: 128216
Status: resolved
Priority: 0/
Queue: Perl-Tidy

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

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



Subject: perltidy inserts a blank line...
perltidy inserts a blank line, and even does it before the _second_ "if ("! $ cat eee.pl for (qw/folder value action kv/) { $h{$_} = shift or die "no $_ given on command line"; } die "Extra arguments" if @ARGV; $kv =~ /^(\S+): (.+)/ or die "kv didn't match."; $h{header} = $1; $h{value} = $2; $imap->select( $h{folder} ) or die "select $h{folder} error: ", $imap->LastError, "\n"; my @iids = $imap->search( HEADER => $h{header} => \$imap->Quote( $h{value} ) ); if ( @iids == 1 ) { if ( $h{action} eq 'ZAP' ) { $a++; } } $ perltidy -log < eee.pl | diff -U 1 eee.pl - ... if ( @iids == 1 ) { + if ( $h{action} eq 'ZAP' ) { $ cat perltidy.LOG perltidy version 20180220 log file on a linux system, OLD_PERL_VERSION=5.028001 Configuration and command line parameters for this run: -log To find error messages search for 'WARNING' with your editor Indentation will be with 4 spaces Line 1 implies starting-indentation-level = 0 Suggest including 'use warnings;' Suggest including 'use strict;' The nesting depths in the table below are at the start of the lines. The indicated output line numbers are not always exact. ci = levels of continuation indentation; bk = 1 if in BLOCK, 0 if not. in:out indent c b nesting code + messages; (messages begin with >>>) lines levels i k (code begins with one '.' per indent level) ------ ----- - - -------- ------------------------------------------- L15:15 i0:0 0 1 { >>>Last line No indentation disagreement seen No lines exceeded 80 characters Maximum output line length was 79 at line 10 Sorry Debian has an old version...
You can use -nbbb (--noblanks-before-blocks) to prevent this.
Subject: Re: [rt.cpan.org #128216] perltidy inserts a blank line...
Date: Sat, 12 Jan 2019 07:38:10 +0800
To: "Steve Hancock via RT" <bug-Perl-Tidy [...] rt.cpan.org>
From: 積丹尼 Dan Jacobson <jidanni [...] jidanni.org>
OK, but please tighten the algorithm even more. Nobody would expect a blank line inserted at line 12. If you are going to insert a blank line, please do it before line 11. Thanks. $ perltidy < eee.pl | nl -b a 1 for (qw/folder value action kv/) { 2 $h{$_} = shift or die "no $_ given on command line"; 3 } 4 die "Extra arguments" if @ARGV; 5 $kv =~ /^(\S+): (.+)/ or die "kv didn't match."; 6 $h{header} = $1; 7 $h{value} = $2; 8 $imap->select( $h{folder} ) 9 or die "select $h{folder} error: ", $imap->LastError, "\n"; 10 my @iids = $imap->search( HEADER => $h{header} => \$imap->Quote( $h{value} ) ); 11 if ( @iids == 1 ) { 12 13 if ( $h{action} eq 'ZAP' ) { 14 $a++; 15 } 16 }