Personally I would ban the non block conditional, but I think it's moot in
this context since spotless just does what it does and is not configurable,
as I understand it. I suppose we could manually "fix" all the conditionals
though?

On Wed, Dec 23, 2020, 9:07 AM Erick Erickson <erickerick...@gmail.com>
wrote:

> I took a quick look at lucene/queries just to get my feet wet. Before
> working on it seriously. I did a fast scan through about half of the
> changes and have only one question.
>
> The formatter tightens up non-block comments, i.e.
>
> if (this == obj)
>   return true;
>
> becomes
>
> if (this == obj) return true;
>
> Which one is clearer is always a matter of debate, but my take is that
> braces should be added when the _original_ code was on multiple lines,
> respecting the opinion of the author. So the above would get braces added
> manually:
>
> if (this == obj) {
>   return true;
> }
>
> However, if the original code were:
>
> if( this == obj ) return true;
>
> and it reformatted to:
>
> if (this == obj) return true;
>
> leave it be.
>
> Does this align with other people’s opinion?
>
> Or is the consensus that any changed non-block should have braces added on
> the theory that braces are always clearer and the code was changed anyway?
> In which case the second example would get braces.
>
> I don’t particularly have any strong opinion, and I don’t think we need to
> be draconian about it, just thought that I’d do whatever others are doing.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
> For additional commands, e-mail: dev-h...@lucene.apache.org
>
>

Reply via email to