-
-
Notifications
You must be signed in to change notification settings - Fork 755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New rule: Reports the usages of <expr1>?.let { <expr2> } ?: run { <single_line_expr> }
#6112
Comments
Could the rule be more generic? It looks like what we want flagged is any use of the non-extension version of |
Yes, I think It can be generic. But then we also have to consider single expression use of |
Hi, @3flex got your query yes it should be generic. We can create similar rules for
There is one similar rule Update 29/05/23: We also have |
So the proposal would be to create If that's the idea, we need proper definitions of what these rules should catch. Some more examples of compilant/non-compilant. |
Yes @BraisGabin this suggestion is independent of the previous suggestion as that one deals through the case when due to the last nullable expression code execution pass through the next |
This issue is stale because it has been open 90 days with no activity. Please comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
Not stale |
Sorry for the really late response. How can we make this issue actionable? Would a rule called |
Yes, @BraisGabin that will close the issue. After implementing that and analyzing the learnings from that rule we can implement more rules mentioned in #6112 (comment) |
Ok, so to summarize to anyone reading and willing to contribute. We want a rule called This rule can be expanded in the future but for now just that. |
Expected Behavior of the rule
Rule should report
<expr1>?.let { <expr2> } ?: run { <single_line_expr> }
as expression can be simplified as<expr1>?.let { <expr2> } ?: <single_line_expr>
. Here there is an unnecessary use ofrun { }
blockuncompliant code
compliant code
Context
Got this review in #5981 (comment) having unnecessary
run { }
really makes the code more indented and increases the complexityThe text was updated successfully, but these errors were encountered: