diff mbox

scripts: add checkmaintainers.py

Message ID 20121218203159.GI31255@liondog.tnic (mailing list archive)
State New, archived
Headers show

Commit Message

Borislav Petkov Dec. 18, 2012, 8:31 p.m. UTC
On Tue, Dec 18, 2012 at 11:34:41AM -0800, Joe Perches wrote:
> If no patch is attached, you should get
>
> ERROR: Does not appear to be a unified-diff format patch

Well, it needs to handle the case where a patch simply and only renames
a file.

Then, even if a patch follows:

--

it says:

$ git diff --cached HEAD -- | ./scripts/checkpatch.pl --strict -
Must be run from the top-level dir. of a kernel tree

If I comment out the following hunk:

        if (!defined $root) { 
                print "Must be run from the top-level dir. of a kernel tree\n";
                exit(2);
        }

then it works, albeit with a bunch of warnings:

Use of uninitialized value $root in concatenation (.) or string at ./scripts/checkpatch.pl line 1558.
Use of uninitialized value $root in concatenation (.) or string at ./scripts/checkpatch.pl line 1558.
Use of uninitialized value $root in concatenation (.) or string at ./scripts/checkpatch.pl line 1304.
Use of uninitialized value $root in concatenation (.) or string at ./scripts/checkpatch.pl line 1304.
Use of uninitialized value $root in concatenation (.) or string at ./scripts/checkpatch.pl line 1304.
Use of uninitialized value $root in concatenation (.) or string at ./scripts/checkpatch.pl line 1304.
Use of uninitialized value $root in concatenation (.) or string at ./scripts/checkpatch.pl line 1304.
Use of uninitialized value $root in concatenation (.) or string at ./scripts/checkpatch.pl line 1304.
CHECK: Patch renames README to README.old, update MAINTAINERS?
...

Looks like this would need a bit more work.

Thanks.

Comments

Joe Perches Dec. 18, 2012, 8:36 p.m. UTC | #1
On Tue, 2012-12-18 at 21:31 +0100, Borislav Petkov wrote:
> On Tue, Dec 18, 2012 at 11:34:41AM -0800, Joe Perches wrote:
> > If no patch is attached, you should get
> >
> > ERROR: Does not appear to be a unified-diff format patch
> 
> Well, it needs to handle the case where a patch simply and only renames
> a file.
> 
> Then, even if a patch follows:
> 
> diff --git a/README b/README.old
> similarity index 99%
> rename from README
> rename to README.old
> index a24ec89ba442..b0a7aa56c3cc 100644
> --- a/README
> +++ b/README.old
> @@ -1,3 +1,6 @@
> +TEST
> +
> +
>          Linux kernel release 3.x <http://kernel.org/>
>  
>  These are the release notes for Linux version 3.  Read them carefully,
> --
> 
> it says:
> 
> $ git diff --cached HEAD -- | ./scripts/checkpatch.pl --strict -
> Must be run from the top-level dir. of a kernel tree
> 
> If I comment out the following hunk:
> 
>         if (!defined $root) { 
>                 print "Must be run from the top-level dir. of a kernel tree\n";
>                 exit(2);
>         }
> 
> then it works, albeit with a bunch of warnings:
> 
> Use of uninitialized value $root in concatenation (.) or string at ./scripts/checkpatch.pl line 1558.
> Use of uninitialized value $root in concatenation (.) or string at ./scripts/checkpatch.pl line 1558.
> Use of uninitialized value $root in concatenation (.) or string at ./scripts/checkpatch.pl line 1304.
> Use of uninitialized value $root in concatenation (.) or string at ./scripts/checkpatch.pl line 1304.
> Use of uninitialized value $root in concatenation (.) or string at ./scripts/checkpatch.pl line 1304.
> Use of uninitialized value $root in concatenation (.) or string at ./scripts/checkpatch.pl line 1304.
> Use of uninitialized value $root in concatenation (.) or string at ./scripts/checkpatch.pl line 1304.
> Use of uninitialized value $root in concatenation (.) or string at ./scripts/checkpatch.pl line 1304.
> CHECK: Patch renames README to README.old, update MAINTAINERS?

You renamed README which is one of the filenames used
when checkpatch verifies the top-level dir kernel tree.

Don't do that, README is a required filename.

Try another file in drivers or somewhere other than root.


--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Borislav Petkov Dec. 18, 2012, 8:47 p.m. UTC | #2
On Tue, Dec 18, 2012 at 12:36:37PM -0800, Joe Perches wrote:
> You renamed README which is one of the filenames used
> when checkpatch verifies the top-level dir kernel tree.
> 
> Don't do that, README is a required filename.

$ git mv scripts/checkpatch{,-2}.pl
$ git diff --cached HEAD -- | ./scripts/checkpatch-2.pl --strict -
ERROR: Does not appear to be a unified-diff format patch

total: 1 errors, 0 warnings, 0 checks, 0 lines checked

Your patch has style problems, please review.

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

 [ adjust .git/hooks/pre-commit to use the new ./scripts/checkpatch-2.pl script
   name]

$ git commit -a
scripts/checkpatch-2.pl:2685: space before tab in indent.
+                                               $ok = 1;
scripts/checkpatch-2.pl:2691: space before tab in indent.
+                                               $ok = 1;

No joy :(

Let's try another file:

$ git mv arch/x86/Kconfig{,.old}
$ git diff --cached HEAD -- | ./scripts/checkpatch.pl --strict -
ERROR: Does not appear to be a unified-diff format patch

total: 1 errors, 0 warnings, 0 checks, 0 lines checked

Your patch has style problems, please review.

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

$ git commit -a
arch/x86/Kconfig.old:451: trailing whitespace.
+         Internet Device(MID) platform.

Oh well, enough games for today.
diff mbox

Patch

diff --git a/README b/README.old
similarity index 99%
rename from README
rename to README.old
index a24ec89ba442..b0a7aa56c3cc 100644
--- a/README
+++ b/README.old
@@ -1,3 +1,6 @@ 
+TEST
+
+
         Linux kernel release 3.x <http://kernel.org/>
 
 These are the release notes for Linux version 3.  Read them carefully,