Closed forrestbice closed 3 years ago
Oh, sorry I’m late. I don’t think this is the right solution, since I don’t think that every case where we could use a single line function expression is a place where we should. Consider a method like onEnterScope. A particular implementation may happen to have a single line call that happens to fit on the same line as the declaration of the function, but I wouldn’t think it would be a good idea to make it a function expression. It seems fairly accidental at the moment that the implementation only has one line in it (that it only does one thing) — more accidental for a lifecycle hook like that than for many other things — and I don’t like the semantics of saying that the onEnterScope is definitionally that single line. And so we’re going to have what I think are a lot of false hits of this rule, leading to warning noise we’ll have to suppress or live with (neither of which are great). Also, this sort of fundamental addition to the style rules requires a larger conversation than in our team, so please don’t merge that PR unless you’ve taken this to a broader audience and gotten consensus. A lot of teams and people share that java styles.
Strongly opposed to this.
This repo is for formatting style. That is, it makes no assertion as to which form is right. It merely ensures that both forms are formatted correctly.
Add the Kotlin
UseExpressionBody
inspection as a warning since it is part of the Square style guide.Becomes