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

Lintian test fail can not understand



Hi,

I could not understand why perlcritic test fail with following patch

Any guidance is welcome

Bastien
diff --git a/checks/files.pm b/checks/files.pm
index bfcc877..0b36a9d 100644
--- a/checks/files.pm
+++ b/checks/files.pm
@@ -24,6 +24,7 @@ use warnings;
 use autodie;
 
 use Lintian::Data;
+use Lintian::Check qw($COMPRESS_FILE_EXTENSIONS_OR_ALL);
 use Lintian::Output qw(warning);
 use Lintian::Tags qw(tag);
 use Lintian::Util qw(drain_pipe fail is_string_utf8_encoded open_gz
@@ -91,17 +92,6 @@ my $PKG_CONFIG_BAD_REGEX
   = Lintian::Data->new('files/pkg-config-bad-regex',qr/~~~~~/,
     sub { return  qr/$_[0]/xsm;});
 
-my $COMPRESS_FILE_EXTENSIONS
-  = Lintian::Data->new('files/compressed-file-extensions',
-    qr/\s++/,sub { return qr/\Q$_[0]\E/ });
-
-# an OR (|) regex of all compressed extension
-my $COMPRESS_FILE_EXTENSIONS_OR_ALL = sub { qr/(:?$_[0])/ }
-  ->(
-    join('|',
-        map {$COMPRESS_FILE_EXTENSIONS->value($_) }
-          $COMPRESS_FILE_EXTENSIONS->all));
-
 # see tag duplicated-compressed-file
 my $DUPLICATED_COMPRESSED_FILE_REGEX
   = qr/^(.+)\.(?:$COMPRESS_FILE_EXTENSIONS_OR_ALL)$/;
diff --git a/data/common/compressed-file-extensions b/data/common/compressed-file-extensions
new file mode 100644
index 0000000..747f363
--- /dev/null
+++ b/data/common/compressed-file-extensions
@@ -0,0 +1,9 @@
+# list of compressed file extension
+# please alpha sort
+bz
+bz2
+gz
+tgz
+xz
+z
+Z
diff --git a/data/files/compressed-file-extensions b/data/files/compressed-file-extensions
deleted file mode 100644
index 747f363..0000000
--- a/data/files/compressed-file-extensions
+++ /dev/null
@@ -1,9 +0,0 @@
-# list of compressed file extension
-# please alpha sort
-bz
-bz2
-gz
-tgz
-xz
-z
-Z
diff --git a/debian/changelog b/debian/changelog
index 020e1a9..2ab93a2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -38,6 +38,9 @@ lintian (2.5.32) UNRELEASED; urgency=medium
     + [NT] Add missing list of new / removed tags to the
       entry for the previous release.
 
+  * lib/Lintian/Check.pm:
+    + [BR] export $COMPRESS_FILE_EXTENSIONS_OR_ALL a list of all
+      compressed extension.
   * lib/Lintian/Path.pm:
     + [NT] Apply patch from Tomasz Buchert to add "timestamp"
       method.
diff --git a/lib/Lintian/Check.pm b/lib/Lintian/Check.pm
index df31a06..0b0b7bc 100644
--- a/lib/Lintian/Check.pm
+++ b/lib/Lintian/Check.pm
@@ -31,8 +31,12 @@ use Lintian::Tags qw(tag);
 
 our $KNOWN_BOUNCE_ADDRESSES = Lintian::Data->new('fields/bounce-addresses');
 
+our $COMPRESS_FILE_EXTENSIONS
+  = Lintian::Data->new('common/compressed-file-extensions',
+    qr/\s++/,sub { return qr/\Q$_[0]\E/ });
+
 our @EXPORT_OK = qw(check_maintainer check_spelling check_spelling_picky
-  $known_shells_regex
+  $known_shells_regex $COMPRESS_FILE_EXTENSIONS_OR_ALL $COMPRESS_FILE_EXTENSIONS
 );
 
 =head1 NAME
@@ -362,6 +366,18 @@ Regular expression that matches names of any known shell.
 
 our $known_shells_regex = qr'(?:[bd]?a|t?c|(?:pd|m)?k|z)?sh';
 
+=item $COMPRESS_FILE_EXTENSIONS_OR_ALL
+
+An OR (|) regex of all compressed extension.
+
+=cut
+
+our $COMPRESS_FILE_EXTENSIONS_OR_ALL = sub { qr/(:?$_[0])/ }
+  ->(
+    join('|',
+        map { $COMPRESS_FILE_EXTENSIONS->value($_) }
+          $COMPRESS_FILE_EXTENSIONS->all));
+
 =back
 
 =head1 AUTHOR

Reply to: