[SCM] Debian package checker branch, master, updated. 2.5.11-216-g4912b9a
The following commit has been merged in the master branch:
commit 4912b9a7ca6bfec5040f866733e306e656566c55
Author: Niels Thykier <niels@thykier.net>
Date: Tue Apr 2 21:32:46 2013 +0200
Enable more critic policies
Update code to use block grep/map, "reverse sort" and remove use of
map in void context.
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/.perlcriticrc b/.perlcriticrc
index 055de62..fb0787b 100644
--- a/.perlcriticrc
+++ b/.perlcriticrc
@@ -8,10 +8,10 @@ severity = 1
# Work based on a whitelist
only = 1
# Our whitelist (ignores severity):
-include = ExplicitReturnUndef GlobFunction NegativeIndices PrivateVars UselessInitialization MatchVars NumberSeparators NullStatements LongChainsOfMethodCalls UseStrict UseWarnings EndWithOne ConditionalUseStatements PackageMatchesPodName JoinedReadline UnreachableCode TrailingWhitespace InterpolationOfLiterals ImplicitNewlines CommaSeparatedStatements UseStrict UseWarnings UnusedVariables UnusedCapture TwoArgOpen ProhibitHardTabs MismatchedOperators IndirectSyntax Modules::
+include = ExplicitReturnUndef GlobFunction NegativeIndices PrivateVars UselessInitialization MatchVars NumberSeparators NullStatements LongChainsOfMethodCalls UseStrict UseWarnings EndWithOne ConditionalUseStatements PackageMatchesPodName JoinedReadline UnreachableCode TrailingWhitespace InterpolationOfLiterals ImplicitNewlines CommaSeparatedStatements UseStrict UseWarnings UnusedVariables UnusedCapture TwoArgOpen ProhibitHardTabs MismatchedOperators IndirectSyntax Modules:: BuiltinFunctions:: ClassHierarchies::
#include = MixedBooleanOperators InteractiveTest UpperCaseHeredoc ReusedNames PackageVars ConditionalDeclarations SingleCharAlternation FixedStringMatches ConditionalUseStatements QuotedWordLists
-exclude = RequireFilenameMatchesPackage RequireVersionVar ProhibitExcessMainComplexity
+exclude = RequireFilenameMatchesPackage RequireVersionVar ProhibitExcessMainComplexity ProhibitStringySplit ComplexMappings StringyEval
# If you want to try some other stuff, uncomment the following
# (exclude is an incomplete list of things we probably won't change)
diff --git a/checks/debian-source-dir b/checks/debian-source-dir
index 161e77d..0b91dc3 100644
--- a/checks/debian-source-dir
+++ b/checks/debian-source-dir
@@ -63,7 +63,7 @@ if ( ! -l "$dsrc/git-patches" && -s "$dsrc/git-patches") {
open DEBSERIES, '<', $dpseries
or fail("cannot open debian/patches/series: $!");
my $comment_line = <DEBSERIES>;
- my $count = grep !/^\s*+\#|^\s*+$/o, <DEBSERIES>;
+ my $count = grep { !/^\s*+\#|^\s*+$/o } <DEBSERIES>;
tag 'git-patches-not-exported'
unless ($count && ($comment_line =~ m/^\s*\#.*quilt-patches-deb-export-hook/o));
close(DEBSERIES);
diff --git a/checks/java b/checks/java
index b4a73cf..e128efe 100644
--- a/checks/java
+++ b/checks/java
@@ -78,7 +78,7 @@ for my $jar_file (sort keys %{$java_info}) {
$has_public_jars = 1;
}
# check for common code files like .class or .clj (Clojure files)
- foreach my $class (grep m/\.(?:class|clj)$/oi, sort keys %$files) {
+ foreach my $class (grep { m/\.(?:class|clj)$/oi } sort keys %{$files}) {
my $mver = $files->{$class};
$classes = 1;
next if $class =~ m/\.clj$/;
diff --git a/checks/source-copyright b/checks/source-copyright
index d2bba97..d714472 100644
--- a/checks/source-copyright
+++ b/checks/source-copyright
@@ -233,7 +233,7 @@ sub split_licenses {
return () unless defined;
return () if /\n/;
s/[(),]//;
- return map "\L$_", (split /\s++(?:and|or)\s++/);
+ return map { "\L$_" } (split /\s++(?:and|or)\s++/);
}
sub get_field {
diff --git a/checks/standards-version b/checks/standards-version
index f2cb7fa..655847c 100644
--- a/checks/standards-version
+++ b/checks/standards-version
@@ -42,7 +42,7 @@ my $STANDARDS = Lintian::Data->new('standards-version/release-dates', qr/\s+/o);
# release date of the standard released after the one a package declared. Do
# that by pulling all data out of the Lintian::Data structure and sorting it
# by release date. We can also use this to get the current standards version.
-my @STANDARDS = sort { $b->[1] <=> $a->[1] }
+my @STANDARDS = reverse sort { $a->[1] <=> $b->[1] }
map { [ $_, $STANDARDS->value($_) ] } $STANDARDS->all;
my $CURRENT_DATE = $STANDARDS[0][1];
diff --git a/lib/Lintian/Collect/Package.pm b/lib/Lintian/Collect/Package.pm
index c4dfe85..84adaa9 100644
--- a/lib/Lintian/Collect/Package.pm
+++ b/lib/Lintian/Collect/Package.pm
@@ -337,7 +337,7 @@ sub _fetch_index_data {
# the links.
#
# Sort in reverse order (allows pop instead of unshift)
- @sorted = sort {$b cmp $a} keys %candidates;
+ @sorted = reverse sort keys %candidates;
# Our prefered target
$target = pop @sorted;
diff --git a/lib/Lintian/DepMap.pm b/lib/Lintian/DepMap.pm
index 0bdbd99..5fb882a 100644
--- a/lib/Lintian/DepMap.pm
+++ b/lib/Lintian/DepMap.pm
@@ -561,8 +561,9 @@ sub circular {
$self->initialise();
} else {
for my $node (keys %{$self->{'nodes'}}) {
- push @circ, grep $self->{'nodes'}{$node}->{'parents'}->{$_},
- keys %{$self->{'nodes'}{$node}->{'branches'}};
+ my $node_p = $self->{'nodes'}{$node}->{'parents'};
+ my $node_b = $self->{'nodes'}{$node}->{'branches'};
+ push @circ, grep { exists $node_p->{$_} } keys %{$node_p}
}
}
diff --git a/private/refresh-manual-refs b/private/refresh-manual-refs
index 14d77ef..5f7d646 100755
--- a/private/refresh-manual-refs
+++ b/private/refresh-manual-refs
@@ -28,6 +28,7 @@ use strict;
use warnings;
use File::Basename;
+use List::MoreUtils qw(none);
use POSIX qw(strftime);
BEGIN {
@@ -173,7 +174,7 @@ sub extract_refs {
}
if ($ref{url} =~ m/^(.+?\.html)#?/i) {
- push(@linked_pages, $1) if not grep(m/$1/, @linked_pages);
+ push(@linked_pages, $1) if none { m/$1/ } @linked_pages;
}
# If the extracted URL part doesn't look like a URL, assume it is
diff --git a/private/tag-stats b/private/tag-stats
index fd8d8dc..2666b15 100755
--- a/private/tag-stats
+++ b/private/tag-stats
@@ -70,7 +70,9 @@ for my $check (readdir CHECKDIR) {
push(@{$stats{type}{severity}{$code}{$severity}}, $name);
push(@{$stats{type}{both}{$code}{$severity}{$certainty}}, $name);
- map { $stats{needs}{$severity}{$certainty}{$_} = 1 } @needs;
+ for my $need (@needs) {
+ $stats{needs}{$severity}{$certainty}{$_} = 1;
+ }
$num_tags++;
}
--
Debian package checker
Reply to: