Package: lintian Version: 1.23.34 Severity: wishlist Tags: patch Hi,
Attached is a patch to improve the debconf writing style checks: >+ if ($template->{choices} =~ /^\s*(yes\s*,\s*no|no\s*,\s*yes)\s*$/i) { >+ tag "select-with-boolean-choices", "$template->{template}"; >+ } New check to avoid select templates with only a yes/no choice. >- if ($short && $short !~ m/:$/) { >+ if ($short && ($short !~ m/:$/ || $short =~ >m/^(what|who|when|where|which|how)/i)) { > tag "malformed-prompt-in-templates", $template->{template}; > } Some maintainers, when seeing the malformed-prompt-in-templates, just replace the question mark by a colon. This fix should catch most of them. >- if (defined ($extended) && $extended =~ /\?/) { >- tag "using-question-in-extended-description-in-templates", >$template->{template}; >- } >+ } >+ if (defined ($extended) && $extended =~ /\?/) { >+ tag "using-question-in-extended-description-in-templates", >$template->{template}; > } See http://cvs.debian.org/ddp/manuals.sgml/developers-reference/developers-reference.sgml?root=debian-doc&r1=1.324&r2=1.325 > if (defined $template->{description}) { >- if ($template->{description} =~ >/(\A|\s)(I|[Mm]y|[Ww]e|[Oo]ur|[Oo]urs|mine|myself|ourself|me|us) /) { >+ if ($template->{description} =~ >/(\A|\s)(I|[Mm]y|[Ww]e|[Oo]ur|[Oo]urs|mine|myself|ourself|me|us)(\Z|\s)/) { > tag "using-first-person-in-templates", $template->{template}; > } >- if ($template->{description} =~ /[ \'\"]([Yy]es)[ \'\",.]/) { >- tag "making-assumptions-about-interfaces-in-templates", >$template->{template}; >+ if ($template->{description} =~ /[ \'\"](yes[ >\'\",;.]|no[\'\",;.])/i) { >+ tag "making-assumptions-about-interfaces-in-templates", >$template->{template} if ($type eq 'boolean'); > } > } Minor improvements. Cheers, -- Thomas Huriaux
--- /usr/share/lintian/checks/debconf.desc 2007-04-28 06:36:33.000000000 +0200 +++ debconf.desc 2007-08-25 11:26:11.000000000 +0200 @@ -290,3 +290,9 @@ needed (e.g. "welcome" notes). Changing the templates type to "error" can also be appropriate, such as for input validation errors. Ref: policy 3.9.1 + +Tag: select-with-boolean-choices +Type: warning +Info: Select templates with yes/no choices should use the boolean + type. +Ref: debconf-devel(7)
--- /usr/share/lintian/checks/debconf 2007-04-28 06:09:29.000000000 +0200 +++ debconf 2007-08-25 11:26:00.000000000 +0200 @@ -215,6 +215,9 @@ } } } + if ($template->{choices} =~ /^\s*(yes\s*,\s*no|no\s*,\s*yes)\s*$/i) { + tag "select-with-boolean-choices", "$template->{template}"; + } } if ($isselect and not exists $template->{choices}) { @@ -280,7 +283,7 @@ unless ($short =~ /for internal use/i) { my $isprompt = grep { $_ eq $type } qw(string select password multiselect); if ($isprompt) { - if ($short && $short !~ m/:$/) { + if ($short && ($short !~ m/:$/ || $short =~ m/^(what|who|when|where|which|how)/i)) { tag "malformed-prompt-in-templates", $template->{template}; } if ($short =~ /^(Please|Cho+se|Enter|Select|Specify|Give)/) { @@ -291,9 +294,9 @@ if ($short !~ /\?/) { tag "malformed-question-in-templates", $template->{template}; } - if (defined ($extended) && $extended =~ /\?/) { - tag "using-question-in-extended-description-in-templates", $template->{template}; - } + } + if (defined ($extended) && $extended =~ /\?/) { + tag "using-question-in-extended-description-in-templates", $template->{template}; } if ($type eq 'note') { if ($short =~ /[.?;:]$/) { @@ -304,11 +307,11 @@ tag "too-long-short-description-in-templates", $template->{template}; } if (defined $template->{description}) { - if ($template->{description} =~ /(\A|\s)(I|[Mm]y|[Ww]e|[Oo]ur|[Oo]urs|mine|myself|ourself|me|us) /) { + if ($template->{description} =~ /(\A|\s)(I|[Mm]y|[Ww]e|[Oo]ur|[Oo]urs|mine|myself|ourself|me|us)(\Z|\s)/) { tag "using-first-person-in-templates", $template->{template}; } - if ($template->{description} =~ /[ \'\"]([Yy]es)[ \'\",.]/) { - tag "making-assumptions-about-interfaces-in-templates", $template->{template}; + if ($template->{description} =~ /[ \'\"](yes[ \'\",;.]|no[\'\",;.])/i) { + tag "making-assumptions-about-interfaces-in-templates", $template->{template} if ($type eq 'boolean'); } }