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

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

 



On 30/04/2022 21:56, Junio C Hamano wrote:
> Philip Oakley <philipoakley@iee.email> writes:
>
>> On 30/04/2022 05:13, Elia Pinto wrote:
>>> Add a coccinelle semantic patch necessary to reinforce the git coding style
>>> guideline:
>>>
>>> "Do not explicitly compute an integral value with constant 0 or '\ 0', or a
>> s/compute/compare/
>>> pointer value with constant NULL."
>> If this gets re-rolled, perhaps include a simple example for those who
>> don't immediately understand that quoted sentence. It will also help
>> decode the coccinelle script
>>
>> so:     `if (ptr == NULL)` becomes `if (!ptr)`  etc.
> That is certainly a good suggestion, but I am wondering if we want
> to also emphasize another more generally applicable rule that
> appears much earlier in the guideline document:
>
>  - Fixing style violations while working on a real change as a
>    preparatory clean-up step is good, but otherwise avoid useless code
>    churn for the sake of conforming to the style.
>
>    "Once it _is_ in the tree, it's not really worth the patch noise to
>    go and fix it up."
>    Cf. http://lkml.iu.edu/hypermail/linux/kernel/1001.3/01069.html

I think it goes both ways when the 'bad' style can be cargo-cult copied
too easily, negating the value of the guidance.

That said, having 22 patches to renormalise the codebase does end up as
being excessive. And it's not clear if the first cocci patch ends up as
part of the regular lint checking (I'm not a user of cocci..).

I suspect that all the renormalising fixes were the result of a single
cocci check, so having a single patch that makes the codebase clean
would be better, if accepted.
--
Philip




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux