Re: [PATCH] add usage-strings ci check and amend remaining usage strings

From
Abhradeep Chakraborty <hidden>
Date
2022-02-22 10:26:18
Reply to
Ævar Arnfjörð Bjarmason, 2022-02-21
Ævar Arnfjörð Bjarmason [off-list ref] wrote:
But in this case there's really a much easier way to do this, to just
extend something like this:
...
See b6c2a0d45d4 (parse-options: make sure argh string does not have SP
or _, 2014-03-23) for the existing code shown in the context where we
already check "argh" like that, i.e. we're just missing a test for
"help".

Obviously such a function would need to hardcode some of the logic you
added in your shellscript. E.g. this fires on a string ending in "...",
but yours doesn't.
Hello Ævar, I have some query related to this method. I have implemented
the logic locally and tests are also passing. However, I think the test
you mentioned is only running against the builtin files and files that
are used in builtin commands (e.g. `diff.c`, `builtin/add.c` etc.). But
some files from `t/helper` (e.g. t/helper/test-run-command.c) also uses
parse option API and it seems that there are no test files (pardon me if I
am wrong) for checking `parse option usage strings check` for `t/helper`
test-tool commands.

E.g. `grep -r --include="*.c" 'struct option .*\[] = {$' .` command gives
the following output - 

./helper/test-parse-options.c:  struct option options[] = {
./helper/test-lazy-init-name-hash.c:    struct option options[] = {
./helper/test-serve-v2.c:       struct option options[] = {
./helper/test-simple-ipc.c:     struct option options[] = {
./helper/test-parse-pathspec-file.c:    struct option options[] = {
./helper/test-getcwd.c: struct option options[] = {
./helper/test-run-command.c:    struct option options[] = {
./helper/test-run-command.c:    struct option options[] = {
./helper/test-proc-receive.c:   struct option options[] = {
./helper/test-progress.c:       struct option options[] = {
./helper/test-tool.c:   struct option options[] = {

So, these files are using parse-options and there is a chance that in
future, usage strings from these files may violate the style guide. In
this case, all tests will be passing even if there are some style
violations. What do you think?

Thanks :)
Thread (29 messages) 29 messages, 6 authors, last reply 2022-02-26
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help