[lintian] 03/03: Do not run detection of minified file twice
This is an automated email from the git hooks/post-receive script.
broucaries-guest pushed a commit to branch master
in repository lintian.
commit e7ca83253c29d0882b0294b230954a5f2bf1bcdd
Author: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Date: Tue Mar 11 21:55:45 2014 +0100
Do not run detection of minified file twice
Check if the could detect this kind of file by name first.
Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
---
checks/cruft.pm | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/checks/cruft.pm b/checks/cruft.pm
index 1620e97..b93a131 100644
--- a/checks/cruft.pm
+++ b/checks/cruft.pm
@@ -104,6 +104,12 @@ my $WARN_FILE_TYPE = Lintian::Data->new(
};
});
+# get javascript name
+sub _minified_javascript_name_regexp {
+ my $jsv = $WARN_FILE_TYPE->value('source-contains-prebuilt-javascript-object');
+ return defined($jsv) ? $jsv->{'regname'} : qr/(?i)[\.-](?:min|pack(?:ed)?)\.js$/;
+}
+
sub _get_license_check_file {
my ($filename) = @_;
my $data = Lintian::Data->new(
@@ -626,6 +632,10 @@ sub full_text_check {
my ($info, $name, $path) = @_;
my $isjsfile = ($name =~ m/\.js/) ? 1 : 0;
+ if($isjsfile) {
+ my $minjsregexp = _minified_javascript_name_regexp();
+ $isjsfile = ($name =~ m{$minjsregexp}) ? 0 : 1;
+ }
# license string in debian/changelog are probably just change
# Ignore these strings in d/README.{Debian,source}. If they
@@ -694,7 +704,7 @@ sub full_text_check {
if($total > 0) {
my $linelength = $total/($strip =~ tr/\n// + 1);
if($linelength > 255) {
- tag 'source-contains-prebuilt-javascript-object', 'line length is about', $linelength, 'characters';
+ tag 'source-contains-prebuilt-javascript-object', $name, 'means line length is about', $linelength, 'characters';
}
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: