pspp-dev
[Top][All Lists]
Advanced

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

Re: Periods at end of messages.


From: Ben Pfaff
Subject: Re: Periods at end of messages.
Date: Sat, 11 May 2019 08:47:36 -0700
User-agent: Mutt/1.10.1 (2018-07-13)

On Sat, May 11, 2019 at 09:49:47AM +0200, John Darrington wrote:
> Some of our message strings end with a '.'  Whilst others do not.
> This is inconsistent.
> 
> The GNU Coding standards say that messages from interactive programs
> should not end in a period [1] .
> 
> So I'm considering this patch:
> 
> diff --git a/src/libpspp/message.c b/src/libpspp/message.c
> index de3dab8d..0a57e217 100644
> --- a/src/libpspp/message.c
> +++ b/src/libpspp/message.c
> @@ -347,6 +347,16 @@ process_msg (struct msg *m)
>  void
>  msg_emit (struct msg *m)
>  {
> +  if (m->text [strlen (m->text) - 1] == '.')
> +    {
> +      if (0 == strcmp ("C", setlocale (LC_MESSAGES, NULL)))
> +       {
> +         fprintf (stderr, "Message \"%s\" should not end in a period.",
> +                  m->text);
> +         abort ();
> +       }
> +    }
> +
> 
> Lots of source files and tests would need to be fixed too.  Thoughts?

I support consistency and compliance with the GNU coding standards here.
Please do not commit this particular implementation: it means that a
harmless stylistic issue crashes the program, irritates the user, and
spawns bug reports.

It will also have "false positives" where there's some %s at the end of
a message whose expansion ends in a period, causing spurious crashes.
Since PSPP variable names can end in a period (even though that's a bad
idea), and because PSPP syntax lines definitely do, that might be a real
problem.

I'd suggest, instead, that we can find most of these messages with
"grep" or "git grep", e.g.: git grep '\.")'

The standards also say that error messages that include a file name or
program name should not begin with a capital letter.  PSPP violates that
a lot too.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]