Skip to contentSkip to conversation

Misc: detect trailing space in the patches

PATCH Superseded [email protected] 3 participants 5 messages Dec 5, 2012 – Dec 6, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Misc: detect trailing space in the patches

From: Nitin A Kamble <[email protected]>

This commit is for detecting trailing white space in the create-pull-request script.

Thanks,
Nitin

The following changes since commit 381c4b69c7e8b452f4d3de2f8214e6e5f6a9abe7:

sstate.bbclass: fix detection of owners matching sstate files (2012-12-05 15:34:07 +0000)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib nitin/misc
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=nitin/misc

Nitin A Kamble (1):
create-pull-request: detect trailing white space

 scripts/create-pull-request |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 1/1 create-pull-request: detect trailing white space

From: Nitin A Kamble <[email protected]>

Add logic in the create-pull-request to detect the trailing white space inserted by patches.

---
 scripts/create-pull-request |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
scripts/create-pull-request +12 -1
index 9a8913d..c35c427 100755
@@ -173,7 +173,6 @@ mkdir $ODIR
 # Generate the patches and cover letter
 git format-patch -M40 --subject-prefix="$PREFIX" -n -o $ODIR --thread=shallow --cover-letter $RELATIVE_TO..$COMMIT_ID > /dev/null
 
-
 # Customize the cover letter
 CL="$ODIR/0000-cover-letter.patch"
 PM="$ODIR/pull-msg"
@@ -229,3 +228,15 @@ Review their content, especially the summary mail:
 When you are satisfied, you can send them with:
     send-pull-request -a -p $ODIR
 EOM
+
+# Check the patches for trailing white space
+echo 
+egrep -nH -e "^\+\s+$" $ODIR/* > /dev/null
+if [ $? -ne 1 ]; then
+	echo "WARNING: Trailing white space detected at these locations"
+	egrep -nH -e "^\+\s+$" $ODIR/* 
+else
+	echo "Note: No trailing white space is detected in these patches :)"
+fi
+
+
Signature · 1 line
1.7.3.4
#2 lore raw
In reply to [email protected]

Can you add also detection of mixed whitespace? E.g. tab followed by space in multilinear indentation? Only as warning. Thanks

Quoted 32 lines · On Dec 6, 2012 12:38 AM, <[email protected]> wrote:

From: Nitin A Kamble <[email protected]>

This commit is for detecting trailing white space in the create-pull-request script.

Thanks,
Nitin

The following changes since commit
381c4b69c7e8b452f4d3de2f8214e6e5f6a9abe7:

sstate.bbclass: fix detection of owners matching sstate files
(2012-12-05 15:34:07 +0000)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib nitin/misc
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=nitin/misc

Nitin A Kamble (1):
create-pull-request: detect trailing white space

 scripts/create-pull-request |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

--
1.7.3.4

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#3 lore raw

Hi,

Quoted 3 lines · Martin Jansa

Can you add also detection of mixed whitespace? E.g. tab followed by space in multilinear indentation? Only as warning. Thanks

These checks can generate infuriating false positives when your patch modifies upstream code which has trailing or mixed whitespace in either context or removal lines; in this case, removing a line with trailing whitespace and replacing it with one which doesn't would generate a warning. Mixed whitespace is also part of some coding styles, notably the kernel's.

Cheers,
Daniel

#4 lore raw

From: Daniel Stone [mailto:[email protected]]
Sent: Wednesday, December 05, 2012 9:48 PM
To: Martin Jansa
Cc: Kamble, Nitin A; [email protected]
Subject: Re: [yocto] [PATCH 0/1] Misc: detect trailing space in the patches

Hi,

On 6 December 2012 15:23, Martin Jansa <[email protected]<mailto:[email protected]>> wrote:

Can you add also detection of mixed whitespace? E.g. tab followed by space in multilinear indentation? Only as warning. Thanks

These checks can generate infuriating false positives when your patch modifies upstream code which has trailing or mixed whitespace in either context or removal lines; in this case, removing a line with trailing whitespace and replacing it with one which doesn't would generate a warning. Mixed whitespace is also part of some coding styles, notably the kernel's.

Cheers,
Daniel

This code checks for the trialing whitespace only in the lines added by the patches. The context lines or removed lines are not checked. It is easy to check for mixed whitespace also, but before doing that I would like to know the final decision about it, as I see some objection to it too.

Thanks,
Nitin