Re: [PATCH 3/3] checkpatch: Add --showfile to allow input via pipe to show filenames

From: Joe Perches
Date: Thu Jun 04 2015 - 08:41:04 EST


On Thu, 2015-06-04 at 14:18 +0200, Petr Mladek wrote:
> On Wed 2015-06-03 08:53:40, Joe Perches wrote:
> > Using "git diff | ./scripts/checkpatch -" does not have an
> > easy mechanism to see the files and lines actually modified.
> >
> > Add --showfile to see the file and line specified in the diff.
> >
> > When --showfile is used without --terse, the second line of each
> > message output is redundant, so it is removed.
>
> > Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
>
> I like idea but there is a problem, see below.
[]
> > @@ -5606,7 +5618,7 @@ sub process {
> > ERROR("NOT_UNIFIED_DIFF",
> > "Does not appear to be a unified-diff format patch\n");
> > }
> > - if ($is_patch && $chk_signoff && $signoff == 0) {
> > + if ($is_patch && $filename ne '-' && $chk_signoff && $signoff == 0) {
>
> You might use also "cat $patch | ./scripts/checkpatch -" and in this
> case you would want to print the warning.

Yeah, but I'm not straining for likely unusual use-cases.

> It still prints invalid filename:linenum when you call:
> ./scripts/checkpatch 0001-my-commit.patch

I don't see this.
It prints the file/line of the patch without -terse
just as before.

> A better solution would be to omit the filename:linenum information
> for this patch-specific messages or print the patchname instead of
> the filename.

Anyway, I think the patch appropriate to apply
for now and I'll ponder and listen to suggestions
for improvement later.

cheers, Joe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/