The following commit has been merged in the master branch:
commit 89a8da04a92fd3cb913a5e24ff00385a753fd279
Author: Guillem Jover <[email protected]>
Date: Sun Jan 6 20:37:08 2013 +0100
scripts: Do not mix boolean operators
Fixes ValuesAndExpressions::ProhibitMixedBooleanOperators.
diff --git a/scripts/Dpkg/IPC.pm b/scripts/Dpkg/IPC.pm
index 1bc5af6..de0e829 100644
--- a/scripts/Dpkg/IPC.pm
+++ b/scripts/Dpkg/IPC.pm
@@ -151,14 +151,14 @@ sub _sanity_check_opts {
foreach (qw(to_string error_to_string from_string)) {
if (exists $opts{$_} and
- (!ref($opts{$_}) or ref($opts{$_}) ne 'SCALAR')) {
+ (not ref($opts{$_}) or ref($opts{$_}) ne 'SCALAR')) {
internerr("parameter $_ must be a scalar reference");
}
}
foreach (qw(to_pipe error_to_pipe from_pipe)) {
if (exists $opts{$_} and
- (!ref($opts{$_}) or (ref($opts{$_}) ne 'SCALAR' and
+ (not ref($opts{$_}) or (ref($opts{$_}) ne 'SCALAR' and
not $opts{$_}->isa('IO::Handle')))) {
internerr("parameter $_ must be a scalar reference or an IO::Handle
object");
}
diff --git a/scripts/Dpkg/Source/Patch.pm b/scripts/Dpkg/Source/Patch.pm
index 1d7dfd9..4b66d2d 100644
--- a/scripts/Dpkg/Source/Patch.pm
+++ b/scripts/Dpkg/Source/Patch.pm
@@ -384,7 +384,7 @@ sub analyze {
$_ = _getline($self);
HUNK:
- while (defined($_) || not eof($self)) {
+ while (defined($_) or not eof($self)) {
my (%path, %fn);
# skip comments leading up to patch (if any)
while (1) {
@@ -451,7 +451,7 @@ sub analyze {
my $fn = _intuit_file_patched($fn{old}, $fn{new});
my $dirname = $fn;
- if ($dirname =~ s{/[^/]+$}{} && not -d $dirname) {
+ if ($dirname =~ s{/[^/]+$}{} and not -d $dirname) {
$dirtocreate{$dirname} = 1;
}
@@ -561,7 +561,7 @@ sub apply {
# and remove .dpkg-orig files
my @files = keys %{$analysis->{filepatched}};
my $now = $opts{timestamp};
- $now ||= fs_time($files[0]) if $opts{force_timestamp} and scalar @files;
+ $now ||= fs_time($files[0]) if $opts{force_timestamp} && scalar @files;
foreach my $fn (@files) {
if ($opts{force_timestamp}) {
utime($now, $now, $fn) || $! == ENOENT ||
diff --git a/scripts/dpkg-genchanges.pl b/scripts/dpkg-genchanges.pl
index d8a2ee9..5162758 100755
--- a/scripts/dpkg-genchanges.pl
+++ b/scripts/dpkg-genchanges.pl
@@ -424,7 +424,7 @@ if (!is_binaryonly) {
}
my $ext = $compression_re_file_ext;
- if ((($sourcestyle =~ m/i/ && not($include_tarball)) ||
+ if ((($sourcestyle =~ m/i/ && !$include_tarball) ||
$sourcestyle =~ m/d/) &&
grep(m/\.(debian\.tar|diff)\.$ext$/, $checksums->get_files()))
{
diff --git a/scripts/dpkg-name.pl b/scripts/dpkg-name.pl
index 85f1d4f..7f862fa 100755
--- a/scripts/dpkg-name.pl
+++ b/scripts/dpkg-name.pl
@@ -106,7 +106,7 @@ sub getarch($$)
my ($filename, $fields) = @_;
my $arch = $fields->{Architecture};
- if (!$fields->{Architecture} and $options{architecture}) {
+ if (not $fields->{Architecture} and $options{architecture}) {
$arch = get_host_arch();
warning(_g("assuming architecture '%s' for '%s'"), $arch, $filename);
}
@@ -205,7 +205,7 @@ sub move($)
if (filesame($newname, $filename)) {
warning(_g("skipping '%s'"), $filename);
- } elsif (-f $newname and !$options{overwrite}) {
+ } elsif (-f $newname and not $options{overwrite}) {
warning(_g("cannot move '%s' to existing file"), $filename);
} elsif (system(@command, $filename, $newname) == 0) {
info(_g("moved '%s' to '%s'"), basename($filename), $newname);
diff --git a/scripts/dpkg-scanpackages.pl b/scripts/dpkg-scanpackages.pl
index cf5ab17..0277b9c 100755
--- a/scripts/dpkg-scanpackages.pl
+++ b/scripts/dpkg-scanpackages.pl
@@ -156,7 +156,7 @@ sub load_override_extra
GetOptions(\%options, @options_spec);
}
-if (not @ARGV >= 1 && @ARGV <= 3) {
+if (not (@ARGV >= 1 and @ARGV <= 3)) {
usageerr(_g('one to three arguments expected'));
}
diff --git a/scripts/dpkg-scansources.pl b/scripts/dpkg-scansources.pl
index 5429955..9058216 100755
--- a/scripts/dpkg-scansources.pl
+++ b/scripts/dpkg-scansources.pl
@@ -300,7 +300,7 @@ sub main {
local $SIG{__WARN__} = sub { usageerr($_[0]) };
GetOptions(@option_spec);
}
- @ARGV >= 1 && @ARGV <= 3 or usageerr(_g('one to three arguments
expected'));
+ @ARGV >= 1 and @ARGV <= 3 or usageerr(_g('one to three arguments
expected'));
push @ARGV, undef if @ARGV < 2;
push @ARGV, '' if @ARGV < 3;
diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl
index 47a08f8..10d5bc5 100755
--- a/scripts/dpkg-shlibdeps.pl
+++ b/scripts/dpkg-shlibdeps.pl
@@ -358,7 +358,7 @@ foreach my $file (keys %exec) {
$print_name =~ s/\@Base$//;
unless ($sym->{weak}) {
if ($debug or ($in_public_dir and $nb_warnings < 10)
- or (!$in_public_dir and $nb_warnings < 1))
+ or (not $in_public_dir and $nb_warnings < 1))
{
if ($in_public_dir) {
warning(_g('symbol %s used by %s found in none
of the ' .
diff --git a/test/100_critic.t b/test/100_critic.t
index e2b15a5..cfcc692 100644
--- a/test/100_critic.t
+++ b/test/100_critic.t
@@ -85,6 +85,7 @@ my @policies = qw(
ValuesAndExpressions::ProhibitInterpolationOfLiterals
ValuesAndExpressions::ProhibitLongChainsOfMethodCalls
ValuesAndExpressions::ProhibitMismatchedOperators
+ ValuesAndExpressions::ProhibitMixedBooleanOperators
ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters
ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator
ValuesAndExpressions::ProhibitVersionStrings
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]