[dpdk-dev] devtools: add long lines to the list of options

Message ID 1488390259-40462-1-git-send-email-allain.legacy@windriver.com (mailing list archive)
State Accepted, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Allain Legacy March 1, 2017, 5:44 p.m. UTC
  The checkpatch.pl tool is flagging warnings on long debug log strings.
Since splitting these strings makes it difficult to search for logs it is
preferred to allow these as exceptions to the long line rule.  The addition
of the LONG_LINE_STRINGS to the list of exceptions will allow lines that
end with a string to exceed the maximum line length, but lines that end
with variables or other constructs will still be flagged as errors.  Also,
lines that make use of PRIx64 with string concatenation will still be
flagged if the beginning of the last string fragment begins after the 80
character threshold.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
---
 devtools/checkpatches.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Stephen Hemminger March 1, 2017, 6:08 p.m. UTC | #1
On Wed, 1 Mar 2017 12:44:19 -0500
Allain Legacy <allain.legacy@windriver.com> wrote:

> The checkpatch.pl tool is flagging warnings on long debug log strings.
> Since splitting these strings makes it difficult to search for logs it is
> preferred to allow these as exceptions to the long line rule.  The addition
> of the LONG_LINE_STRINGS to the list of exceptions will allow lines that
> end with a string to exceed the maximum line length, but lines that end
> with variables or other constructs will still be flagged as errors.  Also,
> lines that make use of PRIx64 with string concatenation will still be
> flagged if the beginning of the last string fragment begins after the 80
> character threshold.
> 
> Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
> ---
>  devtools/checkpatches.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
> index 78e155e..26ff419 100755
> --- a/devtools/checkpatches.sh
> +++ b/devtools/checkpatches.sh
> @@ -45,7 +45,7 @@ options="$options --ignore=LINUX_VERSION_CODE,FILE_PATH_CHANGES,\
>  VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
>  PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
>  SPLIT_STRING,LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
> -NEW_TYPEDEFS,COMPARISON_TO_NULL"
> +NEW_TYPEDEFS,COMPARISON_TO_NULL,LONG_LINE_STRING"
>  
>  print_usage () {
>  	cat <<- END_OF_HELP

Maybe it is time to have our own DPDK version of checkpatch which knows about
DPDK API's like logging functions?
  
Thomas Monjalon March 1, 2017, 6:38 p.m. UTC | #2
2017-03-01 10:08, Stephen Hemminger:
> > --- a/devtools/checkpatches.sh
> > +++ b/devtools/checkpatches.sh
> > @@ -45,7 +45,7 @@ options="$options --ignore=LINUX_VERSION_CODE,FILE_PATH_CHANGES,\
> >  VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
> >  PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
> >  SPLIT_STRING,LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
> > -NEW_TYPEDEFS,COMPARISON_TO_NULL"
> > +NEW_TYPEDEFS,COMPARISON_TO_NULL,LONG_LINE_STRING"
> 
> Maybe it is time to have our own DPDK version of checkpatch which knows about
> DPDK API's like logging functions?

It is Perl code!
If we can have a reliable maintainer, why not.
  
Gaëtan Rivet March 2, 2017, 1:04 p.m. UTC | #3
On Wed, Mar 01, 2017 at 10:08:51AM -0800, Stephen Hemminger wrote:
>On Wed, 1 Mar 2017 12:44:19 -0500
>Allain Legacy <allain.legacy@windriver.com> wrote:
>
>> The checkpatch.pl tool is flagging warnings on long debug log strings.
>> Since splitting these strings makes it difficult to search for logs it is
>> preferred to allow these as exceptions to the long line rule.  The addition
>> of the LONG_LINE_STRINGS to the list of exceptions will allow lines that
>> end with a string to exceed the maximum line length, but lines that end
>> with variables or other constructs will still be flagged as errors.  Also,
>> lines that make use of PRIx64 with string concatenation will still be
>> flagged if the beginning of the last string fragment begins after the 80
>> character threshold.
>>
>> Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
>> ---
>>  devtools/checkpatches.sh | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
>> index 78e155e..26ff419 100755
>> --- a/devtools/checkpatches.sh
>> +++ b/devtools/checkpatches.sh
>> @@ -45,7 +45,7 @@ options="$options --ignore=LINUX_VERSION_CODE,FILE_PATH_CHANGES,\
>>  VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
>>  PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
>>  SPLIT_STRING,LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
>> -NEW_TYPEDEFS,COMPARISON_TO_NULL"
>> +NEW_TYPEDEFS,COMPARISON_TO_NULL,LONG_LINE_STRING"
>>
>>  print_usage () {
>>  	cat <<- END_OF_HELP
>
>Maybe it is time to have our own DPDK version of checkpatch which knows about
>DPDK API's like logging functions?

Additionally, accepting the format strings PRIu8 and consort would be 
nice, as they are currently flagged as CamelCase. Same as some EAL 
functions (like eal_parse_pci_DomBDF and eal_parse_pci_BDF), but 
renaming those could be a better solution.
  
Thomas Monjalon March 6, 2017, 3:03 p.m. UTC | #4
2017-03-01 12:44, Allain Legacy:
> The checkpatch.pl tool is flagging warnings on long debug log strings.
> Since splitting these strings makes it difficult to search for logs it is
> preferred to allow these as exceptions to the long line rule.  The addition
> of the LONG_LINE_STRINGS to the list of exceptions will allow lines that
> end with a string to exceed the maximum line length, but lines that end
> with variables or other constructs will still be flagged as errors.  Also,
> lines that make use of PRIx64 with string concatenation will still be
> flagged if the beginning of the last string fragment begins after the 80
> character threshold.
> 
> Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
[...]
> --- a/devtools/checkpatches.sh
> +++ b/devtools/checkpatches.sh
> @@ -45,7 +45,7 @@ options="$options --ignore=LINUX_VERSION_CODE,FILE_PATH_CHANGES,\
>  VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
>  PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
>  SPLIT_STRING,LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
> -NEW_TYPEDEFS,COMPARISON_TO_NULL"
> +NEW_TYPEDEFS,COMPARISON_TO_NULL,LONG_LINE_STRING"

Applied and gathered LONG_LINE_STRING and SPLIT_STRING on the same line.
Thanks
  

Patch

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 78e155e..26ff419 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -45,7 +45,7 @@  options="$options --ignore=LINUX_VERSION_CODE,FILE_PATH_CHANGES,\
 VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
 PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
 SPLIT_STRING,LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
-NEW_TYPEDEFS,COMPARISON_TO_NULL"
+NEW_TYPEDEFS,COMPARISON_TO_NULL,LONG_LINE_STRING"
 
 print_usage () {
 	cat <<- END_OF_HELP