From: Eric Sunshine <sunshine@sunshineco.com>
To: "Célestin Matte" <celestin.matte@ensimag.fr>
Cc: Git List <git@vger.kernel.org>,
benoit.person@ensimag.fr,
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Subject: Re: [PATCH 05/18] Turn double-negated expressions into simple expressions
Date: Fri, 7 Jun 2013 16:25:50 -0400 [thread overview]
Message-ID: <CAPig+cRamEU1jREcFnN4hzDaSXNFL2N1gRt98jEBJ7ogzor-ZA@mail.gmail.com> (raw)
In-Reply-To: <51B2129F.3040304@ensimag.fr>
On Fri, Jun 7, 2013 at 1:04 PM, Célestin Matte
<celestin.matte@ensimag.fr> wrote:
> Le 07/06/2013 06:12, Eric Sunshine a écrit :
>> On Thu, Jun 6, 2013 at 3:34 PM, Célestin Matte
>> <celestin.matte@ensimag.fr> wrote:
>>> } elsif ($cmd[0] eq "import") {
>>> - die("Invalid arguments for import\n") unless ($cmd[1] ne "" && !defined($cmd[2]));
>>> + die("Invalid arguments for import\n") if ($cmd[1] eq "" || defined($cmd[2]));
>>> mw_import($cmd[1]);
>>> } elsif ($cmd[0] eq "option") {
>>> - die("Too many arguments for option\n") unless ($cmd[1] ne "" && $cmd[2] ne "" && !defined($cmd[3]));
>>> + die("Too many arguments for option\n") if ($cmd[1] eq "" || $cmd[2] eq "" || defined($cmd[3]));
>>
>> Not new in this patch, but isn't this diagnostic misleading? It will
>> (falsely) claim "too many arguments" if $cmd[1] or $cmd[2] is an empty
>> string. Perhaps it should be reworded like the 'import' diagnostic and
>> say "Invalid arguments for option".
>
> We could even be more precise and separate the cases, i.e., die("Too
> many arguments") when too many arguments are defined and die("Invalid
> arguments") when there are empty strings.
> Not sure if I should integrate it in this patch, though.
If you do choose to be more precise, it should be done as a separate
patch. Each conceptually distinct change should have its own patch.
Doing so makes changes easier to review and (generally) easier to
cherry-pick. For example, in this particular case, "simplify
doubly-negated expressions" is quite conceptually distinct from "emit
more precise diagnostics". (Textually the changes may happen to
overlap, but conceptually they are unrelated.)
next prev parent reply other threads:[~2013-06-07 20:25 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-06 19:34 [PATCH 00/18] git-remote-mediawiki: Follow perlcritic's recommandations Célestin Matte
2013-06-06 19:34 ` [PATCH 01/18] Follow perlcritic's recommendations - level 5 and 4 Célestin Matte
2013-06-07 1:42 ` Eric Sunshine
2013-06-07 8:10 ` Matthieu Moy
2013-06-07 12:11 ` Célestin Matte
2013-06-07 17:43 ` Matthieu Moy
2013-06-06 19:34 ` [PATCH 02/18] Change style of some regular expressions to make them clearer Célestin Matte
2013-06-07 1:54 ` Eric Sunshine
2013-06-07 2:30 ` Junio C Hamano
2013-06-07 4:39 ` Eric Sunshine
2013-06-07 4:51 ` Junio C Hamano
2013-06-07 10:40 ` Peter Krefting
2013-06-06 19:34 ` [PATCH 03/18] Add newline in the end of die() error messages Célestin Matte
2013-06-06 19:34 ` [PATCH 04/18] Prevent local variable $url to have the same name as a global variable Célestin Matte
2013-06-06 19:34 ` [PATCH 05/18] Turn double-negated expressions into simple expressions Célestin Matte
2013-06-07 4:12 ` Eric Sunshine
2013-06-07 17:04 ` Célestin Matte
2013-06-07 20:25 ` Eric Sunshine [this message]
2013-06-07 20:32 ` Célestin Matte
2013-06-06 19:34 ` [PATCH 06/18] Remove unused variable Célestin Matte
2013-06-06 19:34 ` [PATCH 07/18] Rename a variable ($last) so that it does not have the name of a keyword Célestin Matte
2013-06-06 19:34 ` [PATCH 08/18] Explicitely assign local variable as undef and make a proper one-instruction-by- line indentation Célestin Matte
2013-06-07 1:19 ` Eric Sunshine
2013-06-07 8:18 ` Matthieu Moy
2013-06-06 19:34 ` [PATCH 09/18] Check return value of open and remove import of unused open2 Célestin Matte
2013-06-07 8:21 ` Matthieu Moy
2013-06-06 19:34 ` [PATCH 10/18] Put long code into a submodule Célestin Matte
2013-06-07 4:01 ` Eric Sunshine
2013-06-07 4:51 ` Junio C Hamano
2013-06-06 19:34 ` [PATCH 11/18] Modify strings for a better coding-style Célestin Matte
2013-06-07 4:31 ` Eric Sunshine
2013-06-06 19:34 ` [PATCH 12/18] Brace file handles for print for more clarity Célestin Matte
2013-06-06 19:34 ` [PATCH 13/18] Remove "unless" statements and replace them by negated "if" statements Célestin Matte
2013-06-07 3:41 ` Eric Sunshine
2013-06-06 19:34 ` [PATCH 14/18] Don't use quotes for empty strings Célestin Matte
2013-06-06 19:34 ` [PATCH 15/18] Put non-trivial numeric values (e.g., different from 0, 1 and 2) in constants Célestin Matte
2013-06-06 19:34 ` [PATCH 16/18] Fix a typo ("mediwiki" instead of "mediawiki") Célestin Matte
2013-06-06 19:34 ` [PATCH 17/18] Place the open() call inside the do{} struct and prevent failing close Célestin Matte
2013-06-06 21:13 ` Junio C Hamano
2013-06-06 21:30 ` Célestin Matte
2013-06-06 21:58 ` Junio C Hamano
2013-06-06 22:16 ` Célestin Matte
2013-06-06 19:34 ` [PATCH 18/18] Clearly rewrite double dereference Célestin Matte
2013-06-07 4:04 ` Eric Sunshine
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPig+cRamEU1jREcFnN4hzDaSXNFL2N1gRt98jEBJ7ogzor-ZA@mail.gmail.com \
--to=sunshine@sunshineco.com \
--cc=benoit.person@ensimag.fr \
--cc=celestin.matte@ensimag.fr \
--cc=git@vger.kernel.org \
--cc=matthieu.moy@grenoble-inp.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).