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

Bug#757398: lintian: Trigger a warning if the description is the same as the package name



Package: lintian
Version: 2.5.24
Severity: normal

Hello,

The attached patch implements a comparison of the description and the package
name.
If it is the same, we trigger a 'description-is-pkg-name' warning.

For example, we have this with:
acoustid-fingerprinter  Acoustid fingerprinter

Note that the patch in bug #756643 must be applied first.

Cheers,
Sylvestre

-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (900, 'testing'), (600, 'unstable'), (500, 'stable-updates'), (500, 'stable'), (300, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.13-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages lintian depends on:
ii  binutils                       2.24.51.20140604-3
ii  bzip2                          1.0.6-5
ii  diffstat                       1.58-1
ii  file                           1:5.17-1
ii  gettext                        0.18.3.2-1
ii  hardening-includes             2.5
ii  intltool-debian                0.35.0+20060710.1
ii  libapt-pkg-perl                0.1.29+b1
ii  libarchive-zip-perl            1.37-2
ii  libclass-accessor-perl         0.34-1
ii  libclone-perl                  0.36-1
ii  libdpkg-perl                   1.17.6
ii  libemail-valid-perl            1.192-1
ii  libfile-basedir-perl           0.03-1
ii  libipc-run-perl                0.92-1
ii  liblist-moreutils-perl         0.33-2
ii  libparse-debianchangelog-perl  1.2.0-1
ii  libtext-levenshtein-perl       0.06~01-2
ii  libtimedate-perl               2.3000-1
ii  liburi-perl                    1.60-1
ii  man-db                         2.6.6-1
ii  patchutils                     0.3.2-3
ii  perl [libdigest-sha-perl]      5.18.2-7
ii  t1utils                        1.37-2

Versions of packages lintian recommends:
pn  libperlio-gzip-perl             <none>
ii  perl-modules [libautodie-perl]  5.18.2-7

Versions of packages lintian suggests:
pn  binutils-multiarch     <none>
ii  dpkg-dev               1.17.6
ii  libhtml-parser-perl    3.71-1+b1
pn  libtext-template-perl  <none>
pn  libyaml-perl           <none>
ii  xz-utils               5.1.1alpha+20120614-2

-- no debconf information
>From 4c5fd8a61707dc422c21368ed6eab0330f1b5d6c Mon Sep 17 00:00:00 2001
From: Sylvestre Ledru <sylvestre@debian.org>
Date: Thu, 7 Aug 2014 20:34:54 +0200
Subject: [PATCH] [SL] Check if the short description is the same as the
 package name.

---
 checks/description.desc                              |  7 +++++++
 checks/description.pm                                |  6 ++++++
 debian/changelog                                     |  1 +
 t/tests/description-general/debian/debian/control.in | 18 ++++++++++++++++++
 t/tests/description-general/tags                     |  3 +++
 5 files changed, 35 insertions(+)

diff --git a/checks/description.desc b/checks/description.desc
index 8753436..fee50a0 100644
--- a/checks/description.desc
+++ b/checks/description.desc
@@ -38,6 +38,13 @@ Ref: devref 6.2.2
 Info: The description contains only a single word. It is likely that the
  description won't be very clear for the user.
 
+Tag: description-is-pkg-name
+Severity: serious
+Certainty: certain
+Ref: devref 6.2.2
+Info: The description is the same the package name. A better description should
+ be provided for the user.
+
 Tag: extended-description-is-probably-too-short
 Severity: minor
 Certainty: possible
diff --git a/checks/description.pm b/checks/description.pm
index 8d61878..bf9e551 100644
--- a/checks/description.pm
+++ b/checks/description.pm
@@ -81,6 +81,12 @@ sub run {
         if (($wordcount = $synopsis =~ s/((^|\s)\S)/$1/g) == 1) {
             tag 'description-too-short';
         }
+        my $pkg_fmt = lc $pkg;
+        $pkg_fmt =~ s/[-_]/ /g;
+        if ($pkg_fmt eq $synopsis) {
+            tag 'description-is-pkg-name', $synopsis;
+        }
+
 
         # We have to decode into UTF-8 to get the right length for the
         # length check.  If the changelog uses a non-UTF-8 encoding,
diff --git a/debian/changelog b/debian/changelog
index dd7626e..f823b9e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -37,6 +37,7 @@ lintian (2.5.26) UNRELEASED; urgency=medium
     + [BR] Update ref url.  (Closes: #755275).
   * checks/description.{desc,pm}:
     + [SL] Check for one word short description.
+    + [SL] Check if the short description is the same as the package name.
 
   * data/cruft/warn-file-type:
     + [BR] Add debug source suffix for detecting javascript
diff --git a/t/tests/description-general/debian/debian/control.in b/t/tests/description-general/debian/debian/control.in
index bbc6986..cef4661 100644
--- a/t/tests/description-general/debian/debian/control.in
+++ b/t/tests/description-general/debian/debian/control.in
@@ -75,6 +75,24 @@ Description: Short
  .
  And a third. (dummy)
 
+Package: foo-duplicate
+Architecture: {$architecture}
+Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
+Description: foo duplicate
+ The description is the same as the package name.
+ A real description would be appreciated
+ .
+ And a third. (dummy)
+
+Package: foo-bar-duplicate
+Architecture: {$architecture}
+Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
+Description: foo bar duplicate
+ The description is the same as the package name.
+ A real description would be appreciated
+ .
+ And a third. (dummy)
+
 Package: {$source}-dummy
 Section: oldlibs
 Architecture: {$architecture}
diff --git a/t/tests/description-general/tags b/t/tests/description-general/tags
index 321c314..0e3afce 100644
--- a/t/tests/description-general/tags
+++ b/t/tests/description-general/tags
@@ -7,6 +7,9 @@ E: description-general: description-contains-invalid-control-statement
 E: description-general: description-contains-tabs
 E: description-general: description-is-debmake-template
 E: description-general: description-starts-with-package-name
+E: foo-bar-duplicate: description-is-pkg-name foo bar duplicate
+E: foo-duplicate: description-is-pkg-name foo duplicate
+I: description-general source: duplicate-long-description foo-duplicate foo-bar-duplicate
 I: description-general-3: using-first-person-in-description line 5: I
 I: description-general-4: capitalization-error-in-description debian Debian
 I: description-general-syn-spelling: capitalization-error-in-description-synopsis debian Debian
-- 
2.0.1


Reply to: