[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 01/02: Remove/fix unused variables



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit 48e9543739f12d99f7c9b82ee0a3d208af4f29e7
Author: Niels Thykier <niels@thykier.net>
Date:   Fri Jan 22 17:04:14 2016 +0000

    Remove/fix unused variables
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/apache2.pm                     | 10 +++-------
 checks/binaries.pm                    |  1 -
 checks/changelog-file.pm              |  1 -
 checks/changes-file.pm                |  2 +-
 checks/cruft.pm                       |  9 +++------
 checks/debhelper.pm                   |  1 -
 checks/debian-readme.pm               |  2 +-
 checks/fields.pm                      |  5 ++---
 checks/files.pm                       | 12 ++++++------
 checks/group-checks.pm                |  2 +-
 checks/manpages.pm                    | 12 ++++++------
 checks/menu-format.pm                 |  6 ++----
 checks/menus.pm                       |  4 ++--
 checks/rules.pm                       |  4 ++--
 checks/scripts.pm                     |  2 +-
 checks/shared-libs.pm                 |  2 +-
 checks/source-copyright.pm            |  5 ++---
 checks/systemd.pm                     | 13 ++++++-------
 collection/java-info                  |  1 -
 commands/reporting-lintian-harness.pm |  1 -
 commands/reporting-sync-state.pm      |  3 +--
 lib/Lintian/Path.pm                   |  2 +-
 22 files changed, 41 insertions(+), 59 deletions(-)

diff --git a/checks/apache2.pm b/checks/apache2.pm
index 3067659..fd796bf 100644
--- a/checks/apache2.pm
+++ b/checks/apache2.pm
@@ -64,16 +64,14 @@ sub run {
 
             # Package appears to be a web application
             elsif ($file =~ m#^etc/apache2/(conf|site)-available/(.*)$#) {
-                check_web_application_package($pkg, $type, $info, $file, $1,
-                    $2);
+                check_web_application_package($pkg, $info, $file, $1, $2);
                 $seen_apache2_special_file++;
             }
 
             # Package appears to be a legacy web application
             elsif ($file =~ m#^etc/apache2/conf\.d/(.*)$#) {
                 tag 'apache2-reverse-dependency-uses-obsolete-directory',$file;
-                check_web_application_package($pkg, $type, $info, $file,
-                    'conf', $1);
+                check_web_application_package($pkg, $info, $file,'conf', $1);
                 $seen_apache2_special_file++;
             }
 
@@ -96,7 +94,7 @@ sub run {
 }
 
 sub check_web_application_package {
-    my ($pkg, $type, $info, $file, $pkgtype, $webapp) = @_;
+    my ($pkg, $info, $file, $pkgtype, $webapp) = @_;
 
     tag 'non-standard-apache2-configuration-name', $webapp, '!=', "$pkg.conf"
       if $webapp ne "$pkg.conf"
@@ -135,8 +133,6 @@ sub check_module_package {
     # obviously the package should be in all lowercase.
     my $expected_name = 'libapache2-' . lc($module);
 
-    # Package depends on apache2-api-YYYYMMDD
-    my $seen_api_dependency = 0;
     my $rel;
     my $visit = sub {
         if (m/^apache2(?:\.2)?-(?:common|data|bin)$/) {
diff --git a/checks/binaries.pm b/checks/binaries.pm
index 98362be..b7833d4 100644
--- a/checks/binaries.pm
+++ b/checks/binaries.pm
@@ -107,7 +107,6 @@ sub run {
     my $madir;
     my $gnu_triplet_re;
     my $ruby_triplet_re;
-    my $dynsyms = 0;
     my $needs_libc = '';
     my $needs_libcxx = '';
     my $needs_libc_file;
diff --git a/checks/changelog-file.pm b/checks/changelog-file.pm
index 3bb5787..afcf830 100644
--- a/checks/changelog-file.pm
+++ b/checks/changelog-file.pm
@@ -43,7 +43,6 @@ sub run {
     my ($pkg, undef, $info, undef, $group) = @_;
     my $found_html = 0;
     my $found_text = 0;
-    my $ppkg = quotemeta($pkg);
     my ($native_pkg, $foreign_pkg, @doc_files);
 
     # skip packages which have a /usr/share/doc/$pkg -> foo symlink
diff --git a/checks/changes-file.pm b/checks/changes-file.pm
index d432e2c..09a8340 100644
--- a/checks/changes-file.pm
+++ b/checks/changes-file.pm
@@ -31,7 +31,7 @@ use Lintian::Util qw(get_file_checksum);
 my $KNOWN_DISTS = Lintian::Data->new('changes-file/known-dists');
 
 sub run {
-    my ($pkg, undef, $info) = @_;
+    my (undef, undef, $info) = @_;
 
     # If we don't have a Format key, something went seriously wrong.
     # Tag the file and skip remaining processing.
diff --git a/checks/cruft.pm b/checks/cruft.pm
index 261b1e2..e2fb381 100644
--- a/checks/cruft.pm
+++ b/checks/cruft.pm
@@ -960,7 +960,7 @@ sub _warn_prebuilt_javascript{
 # detect if max line of block is > cutoff
 # return false if file is minified
 sub _linelength_test_maxlength {
-    my ($entry, $info, $name, $basename, $dirname, $block, $cutoff) = @_;
+    my ($block, $cutoff) = @_;
     while($block =~ /([^\n]+)\n?/g){
         my $linelength = length($1);
         if($linelength > $cutoff) {
@@ -977,9 +977,7 @@ sub _linelength_test {
     my $line;
     my $nextblock;
 
-    ($linelength)
-      = _linelength_test_maxlength($entry, $info, $name, $basename, $dirname,
-        $block,INSANE_LINE_LENGTH);
+    ($linelength)= _linelength_test_maxlength($block,INSANE_LINE_LENGTH);
     # first check if line >  INSANE_LINE_LENGTH that is likely minification
     # avoid problem by recursive regex with longline
     if($linelength) {
@@ -1015,8 +1013,7 @@ sub _linelength_test {
     while(length($nextblock)) {
         # check line above > SAFE_LINE_LENGTH
         ($linelength,$line,$nextblock)
-          = _linelength_test_maxlength($entry, $info, $name, $basename,
-            $dirname, $nextblock,SAFE_LINE_LENGTH);
+          = _linelength_test_maxlength($nextblock,SAFE_LINE_LENGTH);
         # no long line
         unless($linelength) {
             return;
diff --git a/checks/debhelper.pm b/checks/debhelper.pm
index 21150fa..290566e 100644
--- a/checks/debhelper.pm
+++ b/checks/debhelper.pm
@@ -55,7 +55,6 @@ sub run {
     my $needdhexecbuilddepends = '';
     my $needtomodifyscripts = '';
     my $level;
-    my $seenversiondepends = '0';
     my $compat = 0;
     my $usescdbs = '';
     my $seendhcleank = '';
diff --git a/checks/debian-readme.pm b/checks/debian-readme.pm
index 3ad8247..f95c4db 100644
--- a/checks/debian-readme.pm
+++ b/checks/debian-readme.pm
@@ -30,7 +30,7 @@ my $SPELLING_ERROR_IN_README
   = spelling_tag_emitter('spelling-error-in-readme-debian');
 
 sub run {
-    my ($pkg, undef, $info, undef, $group) = @_;
+    my (undef, undef, $info, undef, $group) = @_;
     my $readme = '';
 
     open(my $fd, '<', $info->lab_data_path('README.Debian'));
diff --git a/checks/fields.pm b/checks/fields.pm
index c057f2f..ab02e77 100644
--- a/checks/fields.pm
+++ b/checks/fields.pm
@@ -726,7 +726,7 @@ sub run {
                     && $known_obsolete_emacs{$alternatives[0]->[0]});
 
                 for my $part_d (@alternatives) {
-                    my ($d_pkg, $d_march, $d_version, $d_arch, undef, $rest,
+                    my ($d_pkg, undef, $d_version, undef, undef, $rest,
                         $part_d_orig)
                       = @$part_d;
 
@@ -973,11 +973,10 @@ sub run {
                         && &$is_dep_field($field));
 
                     for my $part_d (@alternatives) {
-                        my ($d_pkg, $d_march, $d_version, $d_arch, $d_restr,
+                        my ($d_pkg, undef, $d_version, $d_arch, $d_restr,
                             $rest,$part_d_orig)
                           = @$part_d;
 
-                        my $negated = 0;
                         for my $arch (@{$d_arch->[0]}) {
                             if ($arch eq 'all' || !is_arch_or_wildcard($arch)){
                                 tag 'invalid-arch-string-in-source-relation',
diff --git a/checks/files.pm b/checks/files.pm
index 5adebc2..8658684 100644
--- a/checks/files.pm
+++ b/checks/files.pm
@@ -172,7 +172,7 @@ my @FILE_PACKAGE_MAPPING = (
 );
 
 sub _detect_embeded_libraries {
-    my ($fname, $file, $pkg,$info) = @_;
+    my ($fname, $file, $pkg) = @_;
 
     # detect only in regular file
     unless($file->is_regular_file) {
@@ -1406,7 +1406,7 @@ sub run {
             }
 
             # ---------------- embedded libraries
-            _detect_embeded_libraries($fname, $file, $pkg, $info);
+            _detect_embeded_libraries($fname, $file, $pkg);
 
             # ---------------- embedded Feedparser library
             if (    $fname =~ m,/feedparser\.py$,
@@ -1427,7 +1427,7 @@ sub run {
                     and $file->basename eq 'defaultpresets.xml') {
                     # false positive
                 } else {
-                    detect_privacy_breach($info,$file);
+                    detect_privacy_breach($file);
                 }
             }
             # ---------------- fonts
@@ -1721,9 +1721,9 @@ sub run {
             }
             if ($fname =~ m,^usr/share/locale/([^/]+)/$,) {
                 # Without encoding:
-                my ($lwccode) = split(/[.@]/, $1);
+                my ($lwccode) = split(m/[.@]/, $1);
                 # Without country code:
-                my ($lcode) = split(/_/, $lwccode);
+                my ($lcode) = split(m/_/, $lwccode);
 
                 # special exception:
                 if ($lwccode ne 'l10n') {
@@ -2096,7 +2096,7 @@ sub detect_generic_privacy_breach {
 }
 
 sub detect_privacy_breach {
-    my ($info, $file) = @_;
+    my ($file) = @_;
     my %privacybreachhash;
 
     # detect only in regular file
diff --git a/checks/group-checks.pm b/checks/group-checks.pm
index 21c00d1..a3bed60 100644
--- a/checks/group-checks.pm
+++ b/checks/group-checks.pm
@@ -31,7 +31,7 @@ my $KNOWN_PRIOS = Lintian::Data->new('common/priorities', qr/\s*=\s*/o);
 
 sub run {
 
-    my (undef, undef, $info, undef, $group) = @_;
+    my (undef, undef, undef, undef, $group) = @_;
 
     ## To find circular dependencies, we will first generate Strongly
     ## Connected Components using Tarjan's algorithm
diff --git a/checks/manpages.pm b/checks/manpages.pm
index 423dada..c58f7f0 100644
--- a/checks/manpages.pm
+++ b/checks/manpages.pm
@@ -34,7 +34,7 @@ use Lintian::Tags qw(tag);
 use Lintian::Util qw(clean_env drain_pipe fail open_gz);
 
 sub run {
-    my ($pkg, undef, $info, $proc, $group) = @_;
+    my (undef, undef, $info, $proc, $group) = @_;
     my $ginfo = $group->info;
     my (%binary, %link, %manpage, @running_man, @running_lexgrog);
 
@@ -42,7 +42,7 @@ sub run {
     foreach my $file ($info->sorted_index) {
         my $file_info = $file->file_info;
         my $link = $file->link || '';
-        my ($fname, $path, $suffix) = fileparse($file);
+        my ($fname, $path, undef) = fileparse($file);
 
         # Binary that wants a manual page?
         #
@@ -195,7 +195,7 @@ sub run {
                             # then it's likely a language subdir, so let's run
                             # the other component through the same check
                             if ($rest =~ m,^([^/]+)/(.+)$,) {
-                                my ($lang, $rest) = ($1, $2);
+                                my (undef, $rest) = ($1, $2);
                                 if ($rest !~ m,^[^/]+\.\d(?:\S+)?(?:\.gz)?$,) {
                                     tag 'bad-so-link-within-manual-page',$file;
                                 }
@@ -286,7 +286,7 @@ sub run {
                 chomp $line;
                 next if $line =~ /^\.\\\"/o; # comments .\"
                 if ($line =~ /^\.TH\s/) { # header
-                    my ($th_command, $th_title, $th_section, $th_date)
+                    my (undef, undef, $th_section, undef)
                       = Text::ParseWords::parse_line('\s+', 0, $line);
                     if ($th_section && (lc($fn_section) ne lc($th_section))) {
                         tag 'manpage-section-mismatch',
@@ -318,7 +318,7 @@ sub run {
         # Find the manpages in our related dependencies
         my $depinfo = $depproc->info();
         foreach my $file ($depinfo->sorted_index){
-            my ($fname, $path, $suffix) = fileparse($file, qr,\..+$,o);
+            my ($fname, $path, undef) = fileparse($file, qr,\..+$,o);
             my $lang = '';
             next
               unless ($file->is_file or $file->is_symlink)
@@ -349,7 +349,7 @@ sub run {
 sub process_lexgrog_output {
     my ($running) = @_;
     for my $lex_proc (@{$running}) {
-        my ($file, $lexgrog_fd, $pid) = @{$lex_proc};
+        my ($file, $lexgrog_fd, undef) = @{$lex_proc};
         my $desc = <$lexgrog_fd>;
         $desc =~ s/^[^:]+: \"(.*)\"$/$1/;
         if ($desc =~ /(\S+)\s+-\s+manual page for \1/i) {
diff --git a/checks/menu-format.pm b/checks/menu-format.pm
index 3c4644e..e396423 100644
--- a/checks/menu-format.pm
+++ b/checks/menu-format.pm
@@ -540,11 +540,9 @@ sub verify_icon {
 
     $parse = 'size line';
     do { defined($line = <$fd>) or goto parse_error; }
-      until ($line =~ /"\s*([0-9]+)\s*([0-9]+)\s*([0-9]+)\s*([0-9]+)\s*"/);
+      until ($line =~ /"\s*([0-9]+)\s*([0-9]+)\s*(?:[0-9]+)\s*(?:[0-9]+)\s*"/);
     my $width = $1 + 0;
     my $height = $2 + 0;
-    my $numcolours = $3 + 0;
-    my $cpp = $4 + 0;
 
     if ($width > $size || $height > $size) {
         tag 'menu-icon-too-big', "$icon: ${width}x${height} > ${size}x${size}";
@@ -593,7 +591,7 @@ sub verify_desktop_file {
         if ($line =~ /^(.*?)\s*=\s*(.*)$/) {
             my ($tag, $value) = ($1, $2);
             my $basetag = $tag;
-            my ($encoding) = ($basetag =~ s/\[([^\]]+)\]$//);
+            $basetag =~ s/\[([^\]]+)\]$//;
             if (exists $vals{$tag}) {
                 tag 'duplicated-key-in-desktop-entry', "$file:$. $tag";
             } elsif ($DEPRECATED_DESKTOP_KEYS->known($basetag)) {
diff --git a/checks/menus.pm b/checks/menus.pm
index 50a26be..f6a99b1 100644
--- a/checks/menus.pm
+++ b/checks/menus.pm
@@ -53,7 +53,7 @@ our %KNOWN_DOCBASE_FORMAT_FIELDS = (
 our $SECTIONS = Lintian::Data->new('doc-base/sections');
 
 sub run {
-    my ($pkg, $type, $info, undef, $group) = @_;
+    my ($pkg, undef, $info, undef, $group) = @_;
     my (%all_files, %all_links);
 
     my %preinst;
@@ -231,7 +231,7 @@ sub check_doc_base_file {
     }
 
     my $knownfields = \%KNOWN_DOCBASE_MAIN_FIELDS;
-    my (@files, $field, @vals);
+    my ($field, @vals);
     my %sawfields;        # local for each section of control file
     my %sawformats;       # global for control file
     $line           = 0;  # global
diff --git a/checks/rules.pm b/checks/rules.pm
index e1fdf73..3414284 100644
--- a/checks/rules.pm
+++ b/checks/rules.pm
@@ -220,10 +220,10 @@ sub run {
         }
 
         # General assignment - save the variable
-        if (/^\s*(?:\S+\s+)*?(\S+)\s*([:\?\+])?=\s*(.*+)?$/so) {
+        if (/^\s*(?:\S+\s+)*?(\S+)\s*[:\?\+]?=\s*(.*+)?$/so) {
             # This is far too simple from a theoretical PoV, but should do
             # rather well.
-            my ($var, $atype, $value) = ($1, $2, $3);
+            my ($var, $value) = ($1, $2);
             $variables{$var} = $value;
         }
 
diff --git a/checks/scripts.pm b/checks/scripts.pm
index 612de0b..356e41e 100644
--- a/checks/scripts.pm
+++ b/checks/scripts.pm
@@ -1120,7 +1120,7 @@ sub generic_check_bad_command {
                 my $extrainfo = defined($1) ? "\'$1\'" : '';
                 my $inpackage = $bad_cmd_data->{'in_package'};
                 unless($pkg =~ m{$inpackage}) {
-                    tag $bad_cmd_tag, "$file:$.", $extrainfo;
+                    tag $bad_cmd_tag, "$file:$lineno", $extrainfo;
                 }
             }
         }
diff --git a/checks/shared-libs.pm b/checks/shared-libs.pm
index cca1163..3bc4c23 100644
--- a/checks/shared-libs.pm
+++ b/checks/shared-libs.pm
@@ -301,7 +301,7 @@ sub run {
             foreach my $devpkg (@devpkgs) {
                 my $dinfo = $devpkg->info;
                 foreach my $link (@alt) {
-                    if ($devpkg->info->index($link)) {
+                    if ($dinfo->index($link)) {
                         $ok = 1;
                         last PKG;
                     }
diff --git a/checks/source-copyright.pm b/checks/source-copyright.pm
index 22508df..1b5b31c 100644
--- a/checks/source-copyright.pm
+++ b/checks/source-copyright.pm
@@ -246,8 +246,7 @@ sub _parse_dep5 {
           "(line $lines[0]{'format'})";
     }
 
-    my ($found_license_header, $full_license_header, undef,
-        @short_licenses_header)
+    my (undef, $full_license_header, undef,@short_licenses_header)
       =parse_license($first_para->{'license'}, 1);
     for my $short_license (@short_licenses_header) {
         $required_standalone_licenses{$short_license} = 0
@@ -286,7 +285,7 @@ sub _parse_dep5 {
         }
 
         if (defined $license and not defined $files) {
-            my ($found_license, $full_license, $short_license,@short_licenses)
+            my (undef, $full_license, $short_license,@short_licenses)
               = parse_license($license, $current_line);
 
             # Standalone license paragraph
diff --git a/checks/systemd.pm b/checks/systemd.pm
index cbd725f..48ce856 100644
--- a/checks/systemd.pm
+++ b/checks/systemd.pm
@@ -147,7 +147,7 @@ sub get_systemd_service_names {
     my %services;
 
     my $safe_add_service = sub {
-        my ($name, $file) = @_;
+        my ($name) = @_;
         if (exists $services{$name}) {
             # should add a tag here
             return;
@@ -158,16 +158,15 @@ sub get_systemd_service_names {
     for my $file (@{$files_ref}) {
         my $name = $file->basename;
         $name =~ s/\.service$//;
-        $safe_add_service->($name, $file);
+        $safe_add_service->($name);
 
-        my @aliases
-          = extract_service_file_values($info, $file, 'Install', 'Alias', 1);
+        my @aliases= extract_service_file_values($file, 'Install', 'Alias', 1);
 
         for my $alias (@aliases) {
             tag 'systemd-service-alias-without-extension', $file
               if $alias !~ m/\.service$/;
             $alias =~ s/\.service$//;
-            $safe_add_service->($alias, $file);
+            $safe_add_service->($alias);
         }
     }
     return \%services;
@@ -186,7 +185,7 @@ sub check_systemd_service_file {
         tag 'service-file-is-not-a-file', $file;
         return 0;
     }
-    my @values = extract_service_file_values($info, $file, 'Unit', 'After');
+    my @values = extract_service_file_values($file, 'Unit', 'After');
     my @obsolete = grep { /^(?:syslog|dbus)\.target$/ } @values;
     tag 'systemd-service-file-refers-to-obsolete-target', $file, $_
       for @obsolete;
@@ -228,7 +227,7 @@ sub service_file_lines {
 
 # Extracts the values of a specific Key from a .service file
 sub extract_service_file_values {
-    my ($info, $file, $extract_section, $extract_key, $skip_tag) = @_;
+    my ($file, $extract_section, $extract_key, $skip_tag) = @_;
 
     my (@values, $section);
 
diff --git a/collection/java-info b/collection/java-info
index 44639f3..4fa799f 100755
--- a/collection/java-info
+++ b/collection/java-info
@@ -90,7 +90,6 @@ sub collect {
                    | JAR /xo;
 
         if ($filename =~ m#\S+\.jar$#i) {
-            my $has_manifest = 0;
             my $manifest;
             my $azip = Archive::Zip->new;
 
diff --git a/commands/reporting-lintian-harness.pm b/commands/reporting-lintian-harness.pm
index f64b255..d7b1250 100644
--- a/commands/reporting-lintian-harness.pm
+++ b/commands/reporting-lintian-harness.pm
@@ -198,7 +198,6 @@ sub process_worklist {
     my $rounds = 1;
     my @worklist = @{$worklist_ref};
     my $exit_code = 0;
-    my $state_dir = $OPT{'state-dir'};
     my $schedule_chunk_size = $OPT{'schedule-chunk-size'};
     my $start_time = time();
 
diff --git a/commands/reporting-sync-state.pm b/commands/reporting-sync-state.pm
index 69ff1b8..5ad2d6e 100644
--- a/commands/reporting-sync-state.pm
+++ b/commands/reporting-sync-state.pm
@@ -215,8 +215,7 @@ sub remove_if_empty {
 
 sub cleanup_group_state {
     my ($state, $group_id, $backlog) = @_;
-    my ($members, $member);
-    my $changed = 0;
+    my ($members);
     my $group_data = $state->{'groups'}{$group_id};
     $members = $group_data->{'members'};
     if (not exists($ACTIVE_GROUPS{$group_id}) or not $members) {
diff --git a/lib/Lintian/Path.pm b/lib/Lintian/Path.pm
index 5dd0d18..373f6f8 100644
--- a/lib/Lintian/Path.pm
+++ b/lib/Lintian/Path.pm
@@ -467,7 +467,7 @@ files.
 sub file_info {
     my ($self) = @_;
     my $file_info;
-    if (my $file_info = $self->{'_file_info'}) {
+    if ($file_info = $self->{'_file_info'}) {
         return $file_info;
     }
     $file_info = $self->_fs_info->_file_info($self);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: