Replies: 5 comments 7 replies
-
For Kotlin I'd follow the default code-style, which is enforced by the rule-set defined in #8 Said rule-set enforces most of the conventions: I think we can start from there and adapt it to our needing. I have a few preferences that are not enforced by this rule-set, but we could look into creating custom Detekt rules for that:
|
Beta Was this translation helpful? Give feedback.
-
+1
+1, they are evil.
I wouldn't enforce this. I agree there are cases where it could make sense (e.g. order of fields in a
+1. Sometimes they can be useful but risk here is so much greater than the reward. |
Beta Was this translation helpful? Give feedback.
-
Completely agree about functions, also for params it can be tricky, for example for @composable functions we can have a well defined pattern For this matter, we can observe the pattern and create some Detekt rules. About functions, we could keel the alphabetical order in some cases, for example, in class in the data layer (Repository or Data Source), ordering alphabetically should meet the ordering by context, for example: fun deleteMovie
fun deleteTvShow
fun favoriteMovie
fun favoriteTvShow
fun insertMovie
fun insertTvShow |
Beta Was this translation helpful? Give feedback.
-
(moved this to |
Beta Was this translation helpful? Give feedback.
-
I agree with the proposals, but maybe I would be a bit conservative about the following:
given that I love consistency in the codebase, but at the same time, I would like fewer constraints where they are unnecessary. I would like to apply them in specific cases like:
If is it possible I would like to add a new rule (if not exists yet): can we forbid adding anonymous functions inside another function? Lie: fun foo() {
fun anonymousFoo(value: Int) {}
anonymousFoo(2)
} I have seen this approach in some projects but honestly, I think it makes the code less readable, but I would like to hear your opinion too. |
Beta Was this translation helpful? Give feedback.
-
We should decide a set of code convention rules to follow for:
After doing this, we should also remove the entry
.idea
from.gitignore
, ignoring only the files which should not be shared (see here).Beta Was this translation helpful? Give feedback.
All reactions