threads / rfc / 36203

[GSoC14][RFC] Is there any interest in adding a port of checkpatch.pl to contrib/?

Subject: [GSoC14][RFC] Is there any interest in adding a port of checkpatch.pl to contrib/?

## tl;dr

6 messages between Mar 18, 2014 and Mar 19, 2014.

replies: 5people: 4as markdown or json

Jacopo Notarstefano· Mar 18, 2014, 01:38 UTC · lore

It seems to me that the topic of adding the checkpatch.pl script to Git's source tree has cropped up several times in the past, as recently as a couple of days ago: $gmane/243607.

It should be noted that its usage for its sake has been discouraged by Junio Hamano in $gmane/205998. Also, its use is somewhat controversial and has led to flames and even a public fork.

Despite this, I think that git might benefit from a port of checkpatch.pl. In fact, even Junio had admitted to use part of its features later in $gmane/205998.

We could simply use linux's script/checkpatch.pl, but I think a port is needed for these reasons:

1. Git style guidelines are somewhat different and less strict than
their Linux equivalents.
2. Several patch threads bounce back and forth because of style fixes.
A checkpatch script added as a hook could help reduce these and use
more efficiently our time.
3. As far as I can tell, checkpatch needs to be run from the root
folder of a linux repository clone. Cloning several hundred MBs for a
single perl script looks a little foolish to me.

So, is there any interest in adding a port of checkpatch.pl to contrib/? I might work on this as part of GSoC. I still haven't submitted my application about git bisect (life got in the way!), but Michael Heggarty remarked in $gmane/242703 that my original idea had too little meat in it to constitute a good GSoC proposal.

Cheers, Jacopo Notarstefano

Eric Sunshine· Mar 18, 2014, 04:40 UTC · re: Jacopo Notarstefano · lore

Re: [GSoC14][RFC] Is there any interest in adding a port of checkpatch.pl to contrib/?

On Mon, Mar 17, 2014 at 9:38 PM, Jacopo Notarstefano <jacopo.notarstefano@gmail.com> wrote:

Show 6 quoted lines
> It seems to me that the topic of adding the checkpatch.pl script to
> Git's source tree has cropped up several times in the past, as
> recently as a couple of days ago: $gmane/243607.
>
> It should be noted that its usage for its sake has been discouraged by
> Junio Hamano in $gmane/205998.

In the referenced message, Junio says that he often runs checkpatch.pl on incoming patches.

Show 12 quoted lines
> Also, its use is somewhat controversial
> and has led to flames and even a public fork.
>
> Despite this, I think that git might benefit from a port of
> checkpatch.pl. In fact, even Junio had admitted to use part of its
> features later in $gmane/205998.
>
> We could simply use linux's script/checkpatch.pl, but I think a port
> is needed for these reasons:
>
> 1. Git style guidelines are somewhat different and less strict than
> their Linux equivalents.

Are checkpatch.pl's customization options, such as --ignore, insufficient to make it behave in the desired fashion for git?

Show 6 quoted lines
> 2. Several patch threads bounce back and forth because of style fixes.
> A checkpatch script added as a hook could help reduce these and use
> more efficiently our time.
> 3. As far as I can tell, checkpatch needs to be run from the root
> folder of a linux repository clone. Cloning several hundred MBs for a
> single perl script looks a little foolish to me.

No need to clone the kernel. checkpatch.pl runs fine standalone with the --no-tree option.

Show 8 quoted lines
> So, is there any interest in adding a port of checkpatch.pl to
> contrib/? I might work on this as part of GSoC. I still haven't
> submitted my application about git bisect (life got in the way!), but
> Michael Heggarty remarked in $gmane/242703 that my original idea had
> too little meat in it to constitute a good GSoC proposal.
>
> Cheers,
> Jacopo Notarstefano
Junio C Hamano· Mar 18, 2014, 19:39 UTC · re: Eric Sunshine · lore

Re: [GSoC14][RFC] Is there any interest in adding a port of checkpatch.pl to contrib/?

Eric Sunshine <sunshine@sunshineco.com> writes:
Show 5 quoted lines
>> 1. Git style guidelines are somewhat different and less strict than
>> their Linux equivalents.
>
> Are checkpatch.pl's customization options, such as --ignore,
> insufficient to make it behave in the desired fashion for git?

If we are to officially encourage the use of checkpatch.pl, we should stress that mechanically adhering to its check is *not* the goal. As long as people view it as a tool to _help_ them spot obvious problems before sending their patches out, but the final responsibility to produce readable code is upon themselves, not the script, I am personally fine. Oftentimes we find an occasional long line that is slightly longer than 80-column limit a lot easier to read than chopping it artificially in the middle, for example.

Show 12 quoted lines
>> 2. Several patch threads bounce back and forth because of style fixes.
>> A checkpatch script added as a hook could help reduce these and use
>> more efficiently our time.
>> 3. As far as I can tell, checkpatch needs to be run from the root
>> folder of a linux repository clone. Cloning several hundred MBs for a
>> single perl script looks a little foolish to me.
>
> No need to clone the kernel. checkpatch.pl runs fine standalone with
> the --no-tree option.
>
>> So, is there any interest in adding a port of checkpatch.pl to
>> contrib/?

Not really. Maintaining the forked version is an additional pain we do not necessarily need. Are we going to carry a port of gcc and others?

I would rather prefer to add a paragraph in CodingGuidelines that points at the canonical location to obtain the script, e.g.

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/scripts/checkpatch.pl

and a procedure to run the script over their patch. I am too lazy to check myself, but there must be somewhere we mention the use of format-patch and send-email in the document, and use of the script to check would fall naturally between these two steps, I would think.

Junio C Hamano· Mar 18, 2014, 19:29 UTC · re: Jacopo Notarstefano · lore

Re: [GSoC14][RFC] Is there any interest in adding a port of checkpatch.pl to contrib/?

Jacopo Notarstefano <jacopo.notarstefano@gmail.com> writes:
Show 6 quoted lines
> It seems to me that the topic of adding the checkpatch.pl script to
> Git's source tree has cropped up several times in the past, as
> recently as a couple of days ago: $gmane/243607.
>
> It should be noted that its usage for its sake has been discouraged by
> Junio Hamano in $gmane/205998.
I've never said any such thing.

I only said I am not enthused against a proposal to add a build target that runs checkpatch or equivalent over *all* existing code, which will invite needless churn (read again the part of the message you quoted before I say "I am not enthused").

It is a totally separate issue for submitters to make sure they do not introduce *new* problems, and use of "checkpatch --no-tree" could be one way to do so.

Jacopo Notarstefano· Mar 18, 2014, 23:53 UTC · re: Junio C Hamano · lore

Re: [GSoC14][RFC] Is there any interest in adding a port of checkpatch.pl to contrib/?

On Tue, Mar 18, 2014 at 8:29 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
>
> I've never said any such thing.
>
> I only said I am not enthused against a proposal to add a build
> target that runs checkpatch or equivalent over *all* existing code,
> which will invite needless churn (read again the part of the message
> you quoted before I say "I am not enthused").
>
> It is a totally separate issue for submitters to make sure they do
> not introduce *new* problems, and use of "checkpatch --no-tree"
> could be one way to do so.
>

Sorry for misrepresenting your opinion. My summarization algorithm sometimes is _very_ lossy :)

demerphq· Mar 19, 2014, 08:40 UTC · re: Jacopo Notarstefano · lore

Re: [GSoC14][RFC] Is there any interest in adding a port of checkpatch.pl to contrib/?

On 18 March 2014 02:38, Jacopo Notarstefano <jacopo.notarstefano@gmail.com> wrote:

> 3. As far as I can tell, checkpatch needs to be run from the root
> folder of a linux repository clone. Cloning several hundred MBs for a
> single perl script looks a little foolish to me.
If that is your worry maybe you should upload the script to CPAN.
Yves
-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

← back to recent threads