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

Bug#362145: marked as done ([new check] debconf templates writing style accordance with the dev-ref)



Your message dated Mon, 08 May 2006 14:04:11 -0700
with message-id <E1FdCtn-0002tJ-KP@spohr.debian.org>
and subject line Bug#362145: fixed in lintian 1.23.20
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: lintian
Version: 1.23.16
Severity: wishlist
Tags: patch

Hi,

Most of the debconf templates are not following the recommandations made
by the developers-reference (see section 6.5 especially). For example,
we may have different prompt such as "What is your password?", "Please
enter your password", "Password?", etc. in different packages, while the
developers-reference recommands to use "Password:".

The attached patches add an initial set of checks (which can of course
be improved) for accordance with the developers-reference. Most of the
descriptions in debconf.desc.diff are only copy/pasted from the dev-ref.

I have tried to make the addition of new checks as easy as possible.

If you need help to understand this patch, please do not hesitate to ask
me.

You may want to see the results (or a list of packages to test these
checks): they are available at
http://haydn.debian.org/~thuriaux-guest/templates/
Note that theses results are based on the source packages, while the
lintian checks added by these patches are made on the binary packages,
so they may differ a little.

Cheers,

-- 
Thomas Huriaux
--- debconf	2006-03-16 04:32:14.000000000 +0100
+++ debconf.new	2006-04-12 15:40:12.000000000 +0200
@@ -64,6 +64,118 @@
 
 return unless $seenconfig or $seentemplates;
 
+# Definition of unitary tests for debconf writing style
+
+my %testSuite = (
+  "isNotAPrompt" => \&isNotAPrompt,
+  "isAFullSentence" => \&isAFullSentence,
+  "isNotATitle" => \&isNotATitle,
+  "isNotAQuestion" => \&isNotAQuestion,
+  "shortIsTooLong" => \&shortIsTooLong,
+  "extendedIsTooLong" => \&extendedIsTooLong,
+  "usingYesOrNo" => \&usingYesOrNo,
+  "isPersonal" => \&isPersonal,
+  "containsAQuestion" => \&containsAQuestion
+);
+
+my %testsDescription;
+@{$testsDescription{'string'}} = ('isNotAPrompt','isAFullSentence');
+@{$testsDescription{'note'}} = ('isNotATitle');
+@{$testsDescription{'select'}} = ('isNotAPrompt', 'isAFullSentence');
+@{$testsDescription{'boolean'}} = ('isNotAQuestion');
+@{$testsDescription{'password'}} = ('isNotAPrompt', 'isAFullSentence');
+@{$testsDescription{'multiselect'}} = ('isNotAPrompt', 'isAFullSentence');
+@{$testsDescription{'text'}} = ();
+@{$testsDescription{'error'}} = ();
+
+my @globalDescriptionTests = ('shortIsTooLong');
+
+my %testsExtended;
+@{$testsExtended{'string'}} = ();
+@{$testsExtended{'note'}} = ();
+@{$testsExtended{'select'}} = ();
+@{$testsExtended{'boolean'}} = ('containsAQuestion');
+@{$testsExtended{'password'}} = ();
+@{$testsExtended{'multiselect'}} = ();
+@{$testsExtended{'text'}} = ();
+@{$testsExtended{'error'}} = ();
+
+my @globalExtendedTests = ('extendedIsTooLong');
+
+my @globalTests = ('isPersonal', 'usingYesOrNo');
+
+# unitary tests
+sub isNotAPrompt {
+  if ($_[0] !~ m/.*:$/) {
+    tag "malformed-prompt-in-templates", "";
+  }
+}
+
+sub isNotATitle {
+  if ($_[0] =~ m/.*[.?;:]$/) {
+    tag "malformed-title-in-templates", "";
+  }
+}
+
+sub isNotAQuestion {
+  if ($_[0] !~ m/.*\?/) {
+    tag "malformed-question-in-templates", "";
+  }
+}
+
+sub containsAQuestion {
+  if ($_[0] =~ m/\?/) {
+    tag "using-question-in-extended-description-in-templates", "";
+  }
+}
+
+sub isAFullSentence {
+  if ($_[0] =~ m/^(Please|Cho+se|Enter|Select|Specify|Give)/) {
+    tag "using-imperative-form-in-templates", "";
+  }
+}
+
+sub isPersonal {
+  if ($_[0] =~ m/(^(I|My|We|Our|Ours|Me)| (I|my|we|our|ours|mine|myself|ourself|me|us)) /) {
+    tag "using-first-person-in-templates", "";
+  }
+}
+
+sub usingYesOrNo {
+  if ($_[0] =~ m/[ '"]([Yy]es)[ '",.]/) {
+    tag "making-assumptions-about-interfaces-in-templates", "";
+  }
+}
+
+sub shortIsTooLong {
+  if (length($_[0]) > 75) {
+    tag "too-long-short-description-in-templates", "";
+  }
+}
+
+sub extendedIsTooLong {
+  my $lines = 0;
+  foreach my $string (split ("\n",$_[0])) {
+    while (length($string) > 75) {
+      my $pos = rindex($string," ",75);
+      if ($pos == -1) {
+        $pos = index($string," ");
+      }
+      if ($pos == -1) {
+        $string = "";
+      } else {
+        $string = substr($string,$pos+1);
+        $lines++;
+      }
+    }
+    $lines += 1;
+  }
+  if ($lines > 12) {
+    tag "too-long-extended-description-in-templates", "";
+  }
+}
+
+
 # parse depends info for later checks
 
 # Consider every package to depend on itself.
@@ -224,6 +336,15 @@
 	    }
 	}
     }
+    # Check the debconf writing style
+    $template->{description} =~ m/^([^\n]*)\n(.*)$/s;
+    my ($shortDescription, $extendedDescription) = ($1, $2);
+    foreach my $test (@{$testsDescription{$template->{type}}}, @globalTests, @globalDescriptionTests) {
+      $testSuite{$test}->($shortDescription);
+    }
+    foreach my $test (@{$testsExtended{$template->{type}}}, @globalTests, @globalExtendedTests) {
+      $testSuite{$test}->($extendedDescription);
+    }
 }
 
 # Check the maintainer scripts.
--- debconf.desc	2006-03-16 04:32:14.000000000 +0100
+++ debconf.desc.new	2006-04-12 15:40:18.000000000 +0200
@@ -186,3 +186,69 @@
  Since SETTITLE was added after debconf-2.0, one cannot use the normal
  debconf-2.0 alternative to allow for cdebconf or other implementations.
  Instead, use <tt>debconf (>= 1.3.22) | cdebconf (>= 0.43)</tt>.
+
+Tag: malformed-prompt-in-templates
+Type: warning
+Info: The short description of a select, multiselect, string and password
+ debconf template is a prompt and NOT a title. Avoid question style
+ prompts ("IP Address?") in favour of "opened" prompts ("IP address:").
+ The use of colons is recommended.
+
+Tag: malformed-title-in-templates
+Type: warning
+Info: The short description of a note debconf template should be
+ considered to be a *title*.
+
+Tag: malformed-question-in-templates
+Type: warning
+Info: The short description of a boolean debconf template should be
+ phrased in the form of a question which should be kept short and should
+ generally end with a question mark. Terse writing style is permitted and
+ even encouraged if the question is rather long.
+
+Tag: using-question-in-extended-description-in-templates
+Type: warning
+Info: The extended description of a debconf template should NOT include a
+ question. The interaction with the user should happen only in the short
+ description.
+
+Tag: using-imperative-form-in-templates
+Type: warning
+Info: Do NOT use useless imperative constructions such as "Please choose...",
+ "Enter...". Users are clever enough to figure out they have to choose
+ something...
+
+Tag: using-first-person-in-templates
+Type: warning
+Info: You should avoid the use of first person ("I will do this..." or
+ "We recommend..."). The computer is not a person and the Debconf
+ templates do not speak for the Debian developers. You should use neutral
+ construction and often the passive form. Those of you who already wrote
+ scientific publications, just write your templates like you would write
+ a scientific paper.
+
+Tag: making-assumptions-about-interfaces-in-templates
+Type: warning
+Info: Templates text should not make reference to widgets belonging to
+ some debconf interfaces. Sentences like "If you answer Yes..." have no
+ meaning for users of graphical interfaces which use checkboxes for
+ boolean questions.
+ .
+ String templates should also avoid mentioning the default values in their
+ description. First, because this is redundant with the values seen by the
+ users. Also, because these default values may be different from the
+ maintainer choices (for instance, when the debconf database was
+ preseeded).
+ .
+ More generally speaking, try to avoid referring to user actions. Just
+ give facts.
+
+Tag: too-long-short-description-in-templates
+Type: warning
+Info: The short description should be limited to 75 chars to fit on one
+ line on a basic 80x25 terminal.
+
+Tag: too-long-extended-description-in-templates
+Type: warning
+Info: The extended description should be limited to 12 lines of 75 chars
+ to fit on a basic 80x25 terminal.

Attachment: signature.asc
Description: Digital signature


--- End Message ---
--- Begin Message ---
Source: lintian
Source-Version: 1.23.20

We believe that the bug you reported is fixed in the latest version of
lintian, which is due to be installed in the Debian FTP archive:

lintian_1.23.20.dsc
  to pool/main/l/lintian/lintian_1.23.20.dsc
lintian_1.23.20.tar.gz
  to pool/main/l/lintian/lintian_1.23.20.tar.gz
lintian_1.23.20_all.deb
  to pool/main/l/lintian/lintian_1.23.20_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 362145@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Russ Allbery <rra@debian.org> (supplier of updated lintian package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Mon,  8 May 2006 13:22:03 -0700
Source: lintian
Binary: lintian
Architecture: source all
Version: 1.23.20
Distribution: unstable
Urgency: low
Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
Changed-By: Russ Allbery <rra@debian.org>
Description: 
 lintian    - Debian package checker
Closes: 196122 232442 321139 362145 365452 365466 365503 366104 366233
Changes: 
 lintian (1.23.20) unstable; urgency=low
 .
   The "Policy backlog clearing is a wonderful sight" release
 .
   * checks/debconf{.desc,}:
     + [RA] Add checks for the Developer's Reference guidelines for debconf
       templates.  Based on a patch by Thomas Huriaux.  (Closes: #362145)
   * checks/fields{.desc,}:
     + [RA] xfonts-encodings is also not an xfont package.  Thanks, Drew
       Parsons.  (Closes: #365503)
     + [RA] Report errors for dependencies on python-minimal.  Thanks to
       Steve Langasek for the analysis.
     + [RA] Allow a build-dependency on patchutils when using CDBS with one
       of the patch systems, as patchutils may be optionally used to check
       for bad patches.  Thanks, Marc Dequènes (Duck).  (Closes: #365466)
     + [RA] Since some packages should be in Build-Depends and some should
       be in Build-Depends-Indep, report all of the misplaced ones rather
       than just the first one.  That way, users know which to move.
     + [RA] Allow perl in Build-Depends if invoked in clean rules.
     + [RA] Allow patch in Build-Depends if yada unpatch is invoked in
       clean rules.
   * checks/files{.desc,}:
     + [RA] Add an explicit check for non-world-readable executables to
       provide a more detailed explanation and tighten the accepted
       permissions of setuid and setgid executables to just the permissions
       mentioned in Policy 10.9.  Add Policy 10.9 references to the
       descriptions.  Reported by Piotr Engelking.  (Closes: #365452)
     + [RA] Add a request to the descriptions of setuid and setgid tags to
       add a lintian override for documentation if the permissions are
       intentional.
     + [RA] Report a more specific tag for binaries that are owned by group
       games but are not setgid.
     + [RA] Remove the check for files in /usr/lib/cgi-bin.  This policy
       change was reverted.
     + [RA] Allow files installed in /usr/include/X11 and /usr/lib/X11 but
       require Pre-Depends on x11-common (>= 1:7.0.0).  Remove the
       duplicate check for files in /usr/bin/X11 since it no longer adds
       additional information.
   * checks/menus{.desc,}:
     + [RA] Check that all files referenced in doc-base control files are
       present in the package, based on a patch by Robert Luberda.  Also
       check that Index references only one file and that Format names a
       known format.  (Closes: #196122)
     + [RA] Fix incomplete diagnosis of missing calls to update-menus.
     + [RA] Change postrm to prerm in the check for a useless install-docs
       call; calling install-docs in postrm is always a warning and useless
       calls in prerm were not being diagnosed.
   * checks/po-debconf{.desc,}:
     + [RA] Exempt packages that use yada from the POTFILES.in check and
       from checking for up-to-date templates, since yada does this at
       build time.  Reported by Piotr Roszatycki.  (Closes: #321139)
     + [RA] Check for stray debconf-mergetemplate files in packages
       using po-debconf.  Thanks, Martin Quinson.  (Closes: #232442)
     + [RA] General cleanup of tag descriptions for grammar and markup.
       Move man page references into Ref fields.
   * checks/shared-libs.desc:
     + [RA] Document that exceptions to the -fPIC rule for shared libraries
       are possible and ask that such exceptions be documented with lintian
       overrides.
   * checks/standards-version:
     + [RA] Update to 3.7.2.  (Closes: #366233)
     + [RA] Report the current standards version when warning about too old
       or too new versions.  Thanks, Jari Aalto.  (Closes: #366104)
 .
   * debian/control:
     + [RA] Update standards version to 3.7.2 (no changes required).
     + [RA] Update description to note calibration for Policy 3.7.2.
Files: 
 f7d0ef1a7b8bb1b85f4fb0696573d62f 803 devel optional lintian_1.23.20.dsc
 96483a812e831dd8e28c518d9110d915 296485 devel optional lintian_1.23.20.tar.gz
 bcbc9d7c5d4f0c09208f30498cc69af7 255036 devel optional lintian_1.23.20_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFEX6jp+YXjQAr8dHYRApPtAJ49m3Xj6GDtgEpHBUJhiPL1dbDx7QCdFxtt
XOPA1e9MWUQOeO74bhRZeH4=
=+w9p
-----END PGP SIGNATURE-----


--- End Message ---

Reply to: