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

jacopo mondi jacopo at jmondi.org
Fri Dec 21 16:17:22 CET 2018


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>

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.

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20181221/1296da4b/attachment.sig>


More information about the libcamera-devel mailing list