Hi Chesnay,

Thanks a lot for your reminder.

For Intellij settings, the style i proposed can be configured as below
* Method declaration parameters: chop down if long
    * align when multiple: YES
    * new line after '(': YES
    * place ')' on new line: YES
* Method call arguments: chop down if long
    * align when multiple: YES
    * take priority over call chain wrapping: YES
    * new line after '(': YES
    * place ')' on new line: YES
* Throws list: chop down if long
    * align when multiline: YES

As far as i know, there does not exist standard checks for the alignment of
method parameters or arguments. It needs further investigation to see
whether we can validate these styles via customized checks.


Biao Liu <mmyy1...@gmail.com> 于2019年8月2日周五 下午4:00写道:

> Hi Andrey,
>
> Thank you for bringing us this discussion.
>
> I would like to make some details clear. Correct me if I am wrong.
>
> The guide draft [1] says the line length is limited in 100 characters. From
> my understanding, this discussion suggests if there is more than 100
> characters in one line (both Scala and Java), we should start a new line
> (or lines).
>
> *Question 1*: If a line does not exceed 100 characters, should we break the
> chained calls into lines? Currently the chained calls always been broken
> into lines even it's not too long. Does it just a suggestion or a
> limitation?
> I prefer it's a limitation which must be respected. And we should always
> break the chained calls no matter how long the line is.
>
> For a chained method calls, the new line should be started with the dot.
>
> *Question 2:* The indent of new line should be 1 tab or 2 tabs? Currently
> there exists these two different styles. This rule should be also applied
> to function arguments.
>
> BTW, big +1 to options from Chesnay. We should make auto-format possible on
> our project.
>
> 1.
>
> https://docs.google.com/document/d/1owKfK1DwXA-w6qnx3R7t2D_o0BsFkkukGlRhvl3XXjQ/edit#
>
> Thanks,
> Biao /'bɪ.aʊ/
>
>
>
> On Fri, Aug 2, 2019 at 9:20 AM SHI Xiaogang <shixiaoga...@gmail.com>
> wrote:
>
> > Hi Andrey,
> >
> > Thanks for bringing this. Personally, I prefer to the following style
> which
> > (1) puts the right parenthese in the next line
> > (2) a new line for each exception if exceptions can not be put in the
> same
> > line
> >
> > That way, parentheses are aligned in a similar way to braces and
> exceptions
> > can be well aligned.
> >
> > *public **void func(*
> > *    int arg1,*
> > *    int arg2,*
> > *    ...
> > *) throws E1, E2, E3 {*
> > *    ...
> > *}*
> >
> > or
> >
> > *public **void func(*
> > *    int arg1,*
> > *    int arg2,*
> > *    ...
> > *) throws
> > *    E1,
> > *    E2,
> > *    E3 {*
> > *    ...
> > *}*
> >
> > Regards,
> > Xiaogang
> >
> > Andrey Zagrebin <and...@ververica.com> 于2019年8月1日周四 下午11:19写道:
> >
> > > Hi all,
> > >
> > > This is one more small suggestion for the recent thread about code
> style
> > > guide in Flink [1].
> > >
> > > We already have a note about using a new line for each chained call in
> > > Scala, e.g. either:
> > >
> > > *values**.stream()**.map(...)**,collect(...);*
> > >
> > > or
> > >
> > > *values*
> > > *    .stream()*
> > > *    .map(*...*)*
> > > *    .collect(...)*
> > >
> > > if it would result in a too long line by keeping all chained calls in
> one
> > > line.
> > >
> > > The suggestion is to have it for Java as well and add the same rule
> for a
> > > long list of function arguments. So it is either:
> > >
> > > *public void func(int arg1, int arg2, ...) throws E1, E2, E3 {*
> > > *    ...*
> > > *}*
> > >
> > > or
> > >
> > > *public **void func(*
> > > *        int arg1,*
> > > *        int arg2,*
> > > *        ...)** throws E1, E2, E3 {*
> > > *    ...*
> > > *}*
> > >
> > > but thrown exceptions stay on the same last line.
> > >
> > > Please, feel free to share you thoughts.
> > >
> > > Best,
> > > Andrey
> > >
> > > [1]
> > >
> > >
> >
> http://mail-archives.apache.org/mod_mbox/flink-dev/201906.mbox/%3ced91df4b-7cab-4547-a430-85bc710fd...@apache.org%3E
> > >
> >
>

Reply via email to