git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 01/23] contrib/coccinnelle: add equals-null.cocci

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 30, 2022, 23:13 UTC
Message-ID
<xmqqr15e5fm3.fsf@gitster.g>
In-Reply-To
<a3e06290-052e-af36-4170-301e567d561d@iee.email>
Philip Oakley <philipoakley@iee.email> writes:
> I think it goes both ways when the 'bad' style can be cargo-cult copied
> too easily, negating the value of the guidance.

Yes, and the cocci rules by themselves do not help protecting our codebase against it all that much.

In order to help developers follow the guideline to avoid adding _new_ instances (by copying-and-pasting), it should be easy to use such a checker in such a way that we can notice only _new_ breakges while ignoring existing offenders. I do not think the current cocci check target in our Makefile is prepared for that.

And there are two ways to deal with that shortcoming.

One, which often appears easier to implement but in the medium term is very costly, is to freeze the codebase and apply tree-wide code churn to make warning disappear.

Then _any_ breakages noticed by an inadequate tool, which does not allow us to notice only the new breakages, after applying a patch to such a cleansed codebase by definition are coming from the patch.

But it is costly. The codebase is rarely frozen, so there isn't a good time to apply such a patch, whether it is 22-patch series or a single patch that concatenates everything into one. There may be more urgent issues than style fixes that would force us to revert a change made before such a tree-wide clean-up, and when that happens, such a "clean-up for clean-up's sake because we cannot check incrementally" will inevitably conflict with such a change.

The other approach is to make it possible (and easy) to check incrementally, so that we can detect new instances made by copying and pasting.

Thanks.
Previous: Philip OakleyNext: Junio C Hamano
Message 6 of 38 in “add a new coccinelle semantic patch to enforce a”
  1. 00/23 add a new coccinelle semantic patch to enforce aElia Pinto, Apr 30, 2022
  2. 01/23 contrib/coccinnelle: add equals-null.cocciElia Pinto, Apr 30, 2022
  3. Philip OakleyApr 30, 2022
  4. Junio C HamanoApr 30, 2022
  5. Philip OakleyApr 30, 2022
  6. Junio C HamanoApr 30, 2022
  7. Junio C HamanoMay 1, 2022
  8. Elia PintoMay 1, 2022
  9. Philip OakleyMay 1, 2022
  10. Junio C HamanoMay 1, 2022
  11. Elia PintoMay 1, 2022
  12. Junio C HamanoMay 2, 2022
  13. Philip OakleyMay 2, 2022
  14. Junio C HamanoMay 2, 2022
  15. Carlo Marcelo Arenas BelónMay 2, 2022
  16. 02/23 apply.c: Fix coding styleElia Pinto, Apr 30, 2022
  17. 03/23 archive.c: Fix coding styleElia Pinto, Apr 30, 2022
  18. 04/23 blame.c: Fix coding styleElia Pinto, Apr 30, 2022
  19. 05/23 branch.c: Fix coding styleElia Pinto, Apr 30, 2022
  20. 08/23 builtin/clone.c: Fix coding styleElia Pinto, Apr 30, 2022
  21. 07/23 builtin/checkout.c: Fix coding styleElia Pinto, Apr 30, 2022
  22. 06/23 builtin/bisect--helper.c: Fix coding styleElia Pinto, Apr 30, 2022
  23. Christian CouderMay 3, 2022
  24. 09/23 builtin/commit.c: Fix coding styleElia Pinto, Apr 30, 2022
  25. 11/23 builtin/gc.c: Fix coding styleElia Pinto, Apr 30, 2022
  26. 10/23 builtin/diff.c: Fix coding styleElia Pinto, Apr 30, 2022
  27. 12/23 builtin/index-pack.c: Fix coding styleElia Pinto, Apr 30, 2022
  28. 13/23 builtin/log.c: Fix coding styleElia Pinto, Apr 30, 2022
  29. 14/23 builtin/ls-remote.c: Fix coding styleElia Pinto, Apr 30, 2022
  30. 16/23 builtin/pack-redundant.c: Fix coding styleElia Pinto, Apr 30, 2022
  31. 15/23 builtin/mailsplit.c: Fix coding styleElia Pinto, Apr 30, 2022
  32. 18/23 builtin/replace.c: Fix coding styleElia Pinto, Apr 30, 2022
  33. 20/23 builtin/shortlog.c: Fix coding styleElia Pinto, Apr 30, 2022
  34. 19/23 builtin/rev-parse.c: Fix coding styleElia Pinto, Apr 30, 2022
  35. 17/23 builtin/receive-pack.c: Fix coding styleElia Pinto, Apr 30, 2022
  36. 21/23 builtin/tag.c: Fix coding styleElia Pinto, Apr 30, 2022
  37. 23/23 commit-graph.c: Fix coding styleElia Pinto, Apr 30, 2022
  38. 22/23 combine-diff.c: Fix coding styleElia Pinto, Apr 30, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.