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

[lintian] 02/03: checks/files.pm: Rewrite DRY-violating calls with for/qw



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

lamby pushed a commit to branch master
in repository lintian.

commit 6f8652287bba7df49bc675539c8db4b6ab9049d5
Author: Chris Lamb <lamby@debian.org>
Date:   Fri Oct 6 19:14:20 2017 +0100

    checks/files.pm: Rewrite DRY-violating calls with for/qw
---
 checks/files.pm | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/checks/files.pm b/checks/files.pm
index 829237f..d48a160 100644
--- a/checks/files.pm
+++ b/checks/files.pm
@@ -2155,24 +2155,14 @@ sub detect_privacy_breach {
                 }
             }
         }
-        if(   index($block,'src="http') > -1
-            ||index($block,'src="ftp') > -1
-            ||index($block,'src="//') > -1
-            ||index($block,'data-href="http') > -1
-            ||index($block,'data-href="ftp') > -1
-            ||index($block,'data-href="//') > -1
-            ||index($block,'codebase="http') > -1
-            ||index($block,'codebase="ftp') > -1
-            ||index($block,'codebase="//') > -1
-            ||index($block,'data="http') > -1
-            ||index($block,'data="ftp') > -1
-            ||index($block,'data="//') > -1
-            ||index($block,'poster="http') > -1
-            ||index($block,'poster="ftp') > -1
-            ||index($block,'poster="//') > -1
-            ||index($block,'<link') > -1
-            ||index($block,'@import') > -1){
+        for my $x (
+            qw(src="http src="ftp src="// data-href="http data-href="ftp
+            data-href="// codebase="http codebase="ftp codebase="// data="http
+            data="ftp data="// poster="http poster="ftp poster="// <link @import)
+          ) {
+            next if index($block, $x) == -1;
             detect_generic_privacy_breach($block,\%privacybreachhash,$file);
+            last;
         }
     }
     close($fd);

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


Reply to: