1 # description -- lintian check script -*- perl -*-
3 # Copyright (C) 1998 Christian Schwarz
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, you can find it on the World Wide
17 # Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
18 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
21 package Lintian::description;
32 my $ppkg = quotemeta($pkg);
33 my $cf = "fields/description";
37 my $unindented_list = 0;
43 tag "package-has-no-description", "";
47 open(IN, '<', $cf) or fail("cannot open $cf for reading: $!");
49 # 1st line contains synopsis
51 $description = $synopsis;
54 if ($synopsis =~ m/^\s*$/) {
55 tag "description-synopsis-is-empty", "";
57 # Current dpkg-gencontrol appears to fix this automatically so this
58 # tag will never trigger with a current dpkg-dev.
59 if ($synopsis =~ m/^\s/) {
60 tag "description-synopsis-has-leading-spaces", "";
62 if ($synopsis =~ m/^\s*$ppkg\b/i) {
63 tag "description-starts-with-package-name", "";
65 if ($synopsis =~ m/\.\s*$/) {
66 tag "description-synopsis-might-not-be-phrased-properly", "";
68 if ($synopsis =~ m/\t/) {
69 tag "description-contains-tabs", "" unless $tabs++;
71 if (length($synopsis) >= 80) {
72 tag "description-too-long", "";
74 if ($synopsis =~ m/^\s*missing\s*$/i) {
75 tag "description-is-debmake-template", "" unless $template++;
76 } elsif ($synopsis =~ m/<insert up to 60 chars description>/) {
77 tag "description-is-dh_make-template", "" unless $template++;
88 my $firstline = lc $_;
89 my $lsyn = lc $synopsis;
90 if ($firstline =~ /^\Q$lsyn\E$/) {
91 tag "description-synopsis-is-duplicated", "";
93 $firstline =~ s/[^a-zA-Z0-9]+//g;
94 $lsyn =~ s/[^a-zA-Z0-9]+//g;
95 if ($firstline eq $lsyn) {
96 tag "description-synopsis-is-duplicated", "";
104 tag "description-contains-invalid-control-statement", "";
105 } elsif (m/^[\-\*]/o) {
106 # Print it only the second time. Just one is not enough to be sure that
107 # it's a list, and after the second there's no need to repeat it.
108 tag "possible-unindented-list-in-extended-description", "" if $unindented_list++ == 2;
112 tag "description-contains-tabs", "" unless $tabs++;
115 if (m,^\s*Homepage: https?://,i) {
116 tag "description-contains-homepage";
120 $wo_quotes =~ s,(\"|\')(.*?)(\1),,;
121 while ($wo_quotes =~ m,(?:\W|^)((\w+)(\s+(\2))+)(?:\W|$),i) {
123 $wo_quotes =~ s/\Q$words//;
124 tag "description-contains-duplicated-word", "$words";
128 # checks for the first line of the extended description:
130 tag "description-starts-with-leading-spaces", "";
132 if (m/^\s*missing\s*$/oi) {
133 tag "description-is-debmake-template", "" unless $template++;
134 } elsif (m/<insert long description, indented with spaces>/) {
135 tag "description-is-dh_make-template", "" unless $template++;
139 if (length($_) >= 80) {
140 tag "extended-description-line-too-long", "";
146 tag "extended-description-is-empty", "" unless $type eq 'udeb';
150 spelling_check('spelling-error-in-description', $description);
151 spelling_check_picky('spelling-error-in-description', $description);
159 # indent-tabs-mode: t
160 # cperl-indent-level: 4
162 # vim: syntax=perl sw=4 ts=8