You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even though this code might look OK, there's a readability issue.
It is not clear if BigDecimal.ZERO is an argument to .add method or .makeLiteral method.
Both variations make it clear that .add takes a single argument.
The observation is that the code should open at most one parenthesis on a single line.
Here's a regexp-driven implementation, however, what it does it finds a line which opens more than one unclosed parenthesis (e.g. eq(gt(x,), but it can't re-format the full expression with new indentation.
Note: eq(gt(x,2),3) is not an issue because all the open parenthesis are closed on the same line
The parenthesis-heavy code is often hard to reason about.
For instance:
Even though this code might look OK, there's a readability issue.
It is not clear if
BigDecimal.ZERO
is an argument to.add
method or.makeLiteral
method.The very same code can be reformatted as
or as
Both variations make it clear that
.add
takes a single argument.The observation is that the code should open at most one parenthesis on a single line.
Here's a regexp-driven implementation, however, what it does it finds a line which opens more than one unclosed parenthesis (e.g.
eq(gt(x,
), but it can't re-format the full expression with new indentation.Note:
eq(gt(x,2),3)
is not an issue because all the open parenthesis are closed on the same lineOther samples of undesired code (see autostyle/autostyle#6 ):
The text was updated successfully, but these errors were encountered: