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

[lintian] 07/09: Fix style nits (perlcritic, perltidy, etc.)



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

nthykier pushed a commit to branch master
in repository lintian.

commit 3312fdbdb976b9b0e57ca58a14fe7974367a9458
Author: Niels Thykier <niels@thykier.net>
Date:   Thu Jul 6 12:53:48 2017 +0000

    Fix style nits (perlcritic, perltidy, etc.)
    
    Usually, we don't add POD to checks so it got "fixed by removal".
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/appstream-metadata.pm | 83 ++++++++++++++------------------------------
 checks/udev.pm               | 30 ++++++++++------
 2 files changed, 45 insertions(+), 68 deletions(-)

diff --git a/checks/appstream-metadata.pm b/checks/appstream-metadata.pm
index af65354..cedf59c 100644
--- a/checks/appstream-metadata.pm
+++ b/checks/appstream-metadata.pm
@@ -40,12 +40,13 @@ use Lintian::Tags qw(tag);
 sub run {
     my ($pkg, $type, $info, $proc, $group) = @_;
 
-    my %desktopfiles;
-    my %metainfo;
-    my @udevrules;
+    my (%desktopfiles, %metainfo, @udevrules);
     my $found_modalias = 0;
     my $modaliases = [];
-    if (defined(my $dir = $info->index_resolved_path('usr/share/applications/'))) {
+    if (
+        defined(
+            my $dir = $info->index_resolved_path('usr/share/applications/'))
+      ) {
         for my $file ($dir->children('breadth-first')) {
             $desktopfiles{$file} = 1 if ($file->is_file);
         }
@@ -81,43 +82,34 @@ sub run {
     return;
 }
 
-=head1 NAME
-
-check_modalias
-
-=head1 DESCRIPTION
-
-Check if a AppStream XML file contain a provides->modalias block and
-check its content.
-
-=cut
 sub check_modalias {
     my ($info, $metadatafile, $modaliases) = @_;
-#    my $metadatafile = $info->index_resolved_path($metadatapath);
-    if (! $metadatafile->is_open_ok()) {
+    if (!$metadatafile->is_open_ok) {
         # FIXME report this as an error
         return;
     }
-    my $xml = XMLin($metadatafile->fs_path(),
-                    ForceArray => [ 'provides', 'modalias' ],
-                    KeepRoot => 1,
-                    KeyAttr => [],
-        );
+    my $xml = XMLin(
+        $metadatafile->fs_path,
+        ForceArray => ['provides', 'modalias'],
+        KeepRoot => 1,
+        KeyAttr => [],
+    );
     if (exists $xml->{'application'}) {
         tag('appstream-metadata-legacy-format', $metadatafile);
         return 0;
     }
-    if (exists $xml->{'component'}
-        && exists $xml->{'component'}->{'provides'}
-        && exists $xml->{'component'}->{'provides'}[0]->{'modalias'}) {
-        for (@{$xml->{'component'}->{'provides'}[0]->{'modalias'}}) {
+    if (   exists $xml->{'component'}
+        && exists $xml->{'component'}{'provides'}
+        && exists $xml->{'component'}{'provides'}[0]{'modalias'}) {
+        for (@{$xml->{'component'}{'provides'}[0]{'modalias'}}) {
             push(@{$modaliases}, $_);
             if (m/^usb:v[0-9a-f]{4}p[0-9a-f]{4}d/i
-                && ! m/^usb:v[0-9A-F]{4}p[0-9A-F]{4}d/) {
-                tag('appstream-metadata-malformed-modalias-provide',
+                && !m/^usb:v[0-9A-F]{4}p[0-9A-F]{4}d/) {
+                tag(
+                    'appstream-metadata-malformed-modalias-provide',
                     $metadatafile,
                     "include non-valid hex digit in USB matching rule '$_'"
-                    );
+                );
             }
         }
         return 1;
@@ -125,32 +117,21 @@ sub check_modalias {
     return 0;
 }
 
-=head1 NAME
-
-provides_user_device
-
-=head1 DESCRIPTION
-
-Check if a udev rule file contain rules for plugdev or uaccess.
-
-=cut
 sub provides_user_device {
     my ($udevrulefile, $linenum, $rule, $data) = @_;
     my $retval = 0;
-    if (
-        m/plugdev/
+    if (   m/plugdev/
         || m/uaccess/
-        || m/MODE=\"0666\"/
-        ) {
+        || m/MODE=\"0666\"/) {
         $retval = 1;
     }
     if ($rule =~ m/SUBSYSTEM=="usb"/) {
         my ($vmatch, $pmatch);
         if ($rule =~ m/ATTR\{idVendor\}=="([0-9a-fA-F]{4})"/) {
-            $vmatch = "v" . uc($1);
+            $vmatch = 'v' . uc($1);
         }
         if ($rule =~ m/ATTR\{idProduct\}=="([0-9a-fA-F]{4})"/) {
-            $pmatch = "p" . uc($1);
+            $pmatch = 'p' . uc($1);
         }
         if (defined $vmatch && defined $pmatch) {
             my $match = "usb:${vmatch}${pmatch}d";
@@ -160,7 +141,7 @@ sub provides_user_device {
                     $foundmatch = 1;
                 }
             }
-            if (! $foundmatch) {
+            if (!$foundmatch) {
                 tag('appstream-metadata-missing-modalias-provide',
                     $udevrulefile, "match rule $match*");
             }
@@ -169,22 +150,10 @@ sub provides_user_device {
     return $retval;
 }
 
-=head1 NAME
-
-check_udev_rules
-
-=head1 DESCRIPTION
-
-Extract all udev rules from a rule file and pass them on one by one to
-the callback function.
-
-This is a copy of a function in udev.pm.
-
-=cut
 sub check_udev_rules {
     my ($file, $check, $data) = @_;
 
-    my $fd = $file->open();
+    my $fd = $file->open;
     my $linenum = 0;
     my $cont;
     my $retval = 0;
diff --git a/checks/udev.pm b/checks/udev.pm
index 3aa5e2a..4e76591 100644
--- a/checks/udev.pm
+++ b/checks/udev.pm
@@ -33,7 +33,7 @@ sub run {
     my $rules_dir = $info->index_resolved_path('lib/udev/rules.d/');
     return unless $rules_dir;
     foreach my $file ($rules_dir->children) {
-        if (! $file->is_open_ok()) {
+        if (!$file->is_open_ok) {
             tag('udev-rule-unreadable', $file);
             next;
         }
@@ -47,8 +47,9 @@ sub check_rule {
 
     # for USB, if everyone or the plugdev group members are
     # allowed access, the uaccess tag should be used too.
-    if ($rule =~ m/SUBSYSTEM=="usb"/
-        && ($rule =~ m/GROUP="plugdev"/
+    if (
+        $rule =~ m/SUBSYSTEM=="usb"/
+        && (   $rule =~ m/GROUP="plugdev"/
             || $rule =~ m/MODE="0666"/)
         && $rule !~ m/ENV\{COLOR_MEASUREMENT_DEVICE\}/
         && $rule !~ m/ENV\{DDC_DEVICE\}/
@@ -64,18 +65,25 @@ sub check_rule {
         && $rule !~ m/ENV\{ID_SECURITY_TOKEN\}/
         && $rule !~ m/ENV\{ID_SMARTCARD_READER\}/
         && $rule !~ m/ENV\{ID_SOFTWARE_RADIO\}/
-        && $rule !~ m/TAG\+="uaccess"/) {
-        tag('udev-rule-missing-uaccess', "$file:$linenum",
-            'user accessible device missing TAG+="uaccess"');
+        && $rule !~ m/TAG\+="uaccess"/
+      ) {
+        tag(
+            'udev-rule-missing-uaccess',
+            "$file:$linenum",
+            'user accessible device missing TAG+="uaccess"'
+        );
     }
 
     # Matching rules mentioning vendor/product should also specify
     # subsystem, as vendor/product is subsystem specific.
-    if ($rule =~ m/ATTR\{idVendor\}=="[0-9a-fA-F]+"/
+    if (   $rule =~ m/ATTR\{idVendor\}=="[0-9a-fA-F]+"/
         && $rule =~ m/ATTR\{idProduct\}=="[0-9a-fA-F]*"/
-        && $rule !~ m/SUBSYSTEM=="[^"]+"/ ) {
-        tag('udev-rule-missing-subsystem', "$file:$linenum",
-            'vendor/product matching missing SUBSYSTEM specifier');
+        && $rule !~ m/SUBSYSTEM=="[^"]+"/) {
+        tag(
+            'udev-rule-missing-subsystem',
+            "$file:$linenum",
+            'vendor/product matching missing SUBSYSTEM specifier'
+        );
     }
     return 0;
 }
@@ -83,7 +91,7 @@ sub check_rule {
 sub check_udev_rules {
     my ($file, $check) = @_;
 
-    my $fd = $file->open();
+    my $fd = $file->open;
     my $linenum = 0;
     my $cont;
     my $retval = 0;

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


Reply to: