Re: [PATCH] add usage-strings ci check and amend remaining usage strings
From: Johannes Schindelin <hidden>
Date: 2022-02-22 10:58:04
Hi Julia, I would like to loop you in here because you have helped us with Coccinelle questions in the past. On Mon, 21 Feb 2022, Abhradeep Chakraborty wrote:
Ævar Arnfjörð Bjarmason [off-list ref] wrote:quoted
That should be fairly easy to do though, and if not we could always just dump these to stderr or something if a git_env_bool("GIT_TEST_PARSE_OPTIONS_DUMP_FIELD_HELP", 0) was true, and do the testing itself in t0012-help.sh.Okay but if the logic can't be implented in the `parse-options.c` file (most probably I will be able to implement the logic), would you allow me to try the `coccinelle script` method you mentioned?
The task at hand is to identify calls to the macro `OPT_CMDMODE()` (and
other, similar macros) that get a fourth argument of the form
N_("<some string>")
The problem is to identify `<some string>` that ends in a `.` (which we
want to avoid) or that starts with some prefix and a colon but follows
with an upper-case character.
In other words, we want to suggest replacing
N_("log: Use something")
or
N_("log: use something.")
by
N_("log: use something")
Ævar suggested that Coccinelle can do that. Could you give us a hand how
this would be possible using `spatch`?
Thank you,
Johannes