[libcamera-devel] [PATCH 4/5] utils: checkstyle: add keep-one-line-blocks

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Dec 21 16:19:53 CET 2018


Hi Jacopo,

On 21/12/2018 15:17, jacopo mondi wrote:
> Hi Kieran,
> 
> On Fri, Dec 21, 2018 at 08:13:10AM +0000, Kieran Bingham wrote:
>> Enable --keep-one-line-blocks to prevent astyle from wanting to move
>> single inlined blocks to cover 4 lines such as:
>>
>> -       virtual int init() { return 0; }
>> +       virtual int init()
>> +       {
>> +               return 0;
>> +       }
>>
> 
> Thanks, this silences a lot of false positives for me!
> 
> Please add my tag and you can push this one in my opinion.
> 
> Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
>> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> 

Thanks, and done.


> The next thing to silence would be in my opinion, astyle trying to
> outsmart me when I force indent to open braces (or where I think is
> more appropriate)
> 
> Eg:
>  	struct media_v2_pad *pad = reinterpret_cast<struct media_v2_pad *>
> -				   (topology.ptr_pads);
> +					   (topology.ptr_pads);
> 
> This might be controversial though, so I would postpone this.

I'll leave this one to you then :)

Cheers


> 
> Thanks
>    j
> 
>> ---
>>  utils/checkstyle.py | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/utils/checkstyle.py b/utils/checkstyle.py
>> index 32974815048a..a40d7dec879f 100755
>> --- a/utils/checkstyle.py
>> +++ b/utils/checkstyle.py
>> @@ -29,6 +29,7 @@ astyle_options = (
>>      '--pad-oper',
>>      '--align-pointer=name',
>>      '--align-reference=name',
>> +    '--keep-one-line-blocks',
>>      '--max-code-length=120'
>>  )
>>
>> --
>> 2.17.1
>>
>> _______________________________________________
>> libcamera-devel mailing list
>> libcamera-devel at lists.libcamera.org
>> https://lists.libcamera.org/listinfo/libcamera-devel

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list