Re: [ovs-dev] [PATCH] checkpatch: Accept form feeds.

2016-04-18 Thread Daniele Di Proietto


On 18/04/2016 14:26, "Ben Pfaff"  wrote:

>On Mon, Apr 18, 2016 at 02:02:37PM -0700, Daniele Di Proietto wrote:
>> CodingStyle.md says:
>> 
>> "Use form feeds (control+L) to divide long source files into logical
>> pieces.  A form feed should appear as the only character on a line."
>> 
>> checkpatch.py currently complains about form feed. For example, on
>> commit 2c06d9a927c5("ovstest: Add test-netlink-conntrack command."),
>> checkpatch.py returns:
>> 
>> W(140): Line has non-spaces leading whitespace
>> W(140): Line has trailing whitespace
>> +
>> 
>> W(177): Line has non-spaces leading whitespace
>> W(177): Line has trailing whitespace
>> +
>> 
>> W(199): Line has non-spaces leading whitespace
>> W(199): Line has trailing whitespace
>> +
>> 
>> This commit suppresses the two warnings for lines with form feeds as the
>> only character.
>> 
>> Signed-off-by: Daniele Di Proietto 
>
>Thanks.
>
>Acked-by: Ben Pfaff 

Thanks, pushed to master!

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] checkpatch: Accept form feeds.

2016-04-18 Thread Ben Pfaff
On Mon, Apr 18, 2016 at 02:02:37PM -0700, Daniele Di Proietto wrote:
> CodingStyle.md says:
> 
> "Use form feeds (control+L) to divide long source files into logical
> pieces.  A form feed should appear as the only character on a line."
> 
> checkpatch.py currently complains about form feed. For example, on
> commit 2c06d9a927c5("ovstest: Add test-netlink-conntrack command."),
> checkpatch.py returns:
> 
> W(140): Line has non-spaces leading whitespace
> W(140): Line has trailing whitespace
> +
> 
> W(177): Line has non-spaces leading whitespace
> W(177): Line has trailing whitespace
> +
> 
> W(199): Line has non-spaces leading whitespace
> W(199): Line has trailing whitespace
> +
> 
> This commit suppresses the two warnings for lines with form feeds as the
> only character.
> 
> Signed-off-by: Daniele Di Proietto 

Thanks.

Acked-by: Ben Pfaff 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] checkpatch: Accept form feeds.

2016-04-18 Thread Daniele Di Proietto
CodingStyle.md says:

"Use form feeds (control+L) to divide long source files into logical
pieces.  A form feed should appear as the only character on a line."

checkpatch.py currently complains about form feed. For example, on
commit 2c06d9a927c5("ovstest: Add test-netlink-conntrack command."),
checkpatch.py returns:

W(140): Line has non-spaces leading whitespace
W(140): Line has trailing whitespace
+

W(177): Line has non-spaces leading whitespace
W(177): Line has trailing whitespace
+

W(199): Line has non-spaces leading whitespace
W(199): Line has trailing whitespace
+

This commit suppresses the two warnings for lines with form feeds as the
only character.

Signed-off-by: Daniele Di Proietto 
---
 utilities/checkpatch.py | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
index dbdcbc8..b641560 100755
--- a/utilities/checkpatch.py
+++ b/utilities/checkpatch.py
@@ -47,6 +47,7 @@ __regex_added_line = re.compile(r'^\+{1,2}[^\+][\w\W]*')
 __regex_leading_with_whitespace_at_all = re.compile(r'^\s+')
 __regex_leading_with_spaces = re.compile(r'^ +[\S]+')
 __regex_trailing_whitespace = re.compile(r'[^\S]+$')
+__regex_single_line_feed = re.compile(r'^\f$')
 __regex_for_if_missing_whitespace = re.compile(r'(if|for|while)[\(]')
 __regex_for_if_too_much_whitespace = re.compile(r'(if|for|while)  +[\(]')
 __regex_for_if_parens_whitespace = re.compile(r'(if|for|while) \( +[\s\S]+\)')
@@ -75,8 +76,10 @@ def leading_whitespace_is_spaces(line):
 """
 if skip_leading_whitespace_check:
 return True
-if __regex_leading_with_whitespace_at_all.search(line) is not None:
+if (__regex_leading_with_whitespace_at_all.search(line) is not None and
+__regex_single_line_feed.search(line) is None):
 return __regex_leading_with_spaces.search(line) is not None
+
 return True
 
 
@@ -85,7 +88,8 @@ def trailing_whitespace_or_crlf(line):
 """
 if skip_trailing_whitespace_check:
 return False
-return __regex_trailing_whitespace.search(line) is not None
+return (__regex_trailing_whitespace.search(line) is not None and
+__regex_single_line_feed.search(line) is None)
 
 
 def if_and_for_whitespace_checks(line):
-- 
2.1.4

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev