Closed github-actions[bot] closed 1 year ago
Companion object はクラス内レイアウトで一番下にくる
The contents of a class should go in the following order:
1. Property declarations and initializer blocks
2. Secondary constructors
3. Method declarations
4. Companion object
定数はすべて SCREAMING_SNAKE_CASE で書く
Names of constants (properties marked with const, or top-level or object val properties with no custom get function that hold deeply immutable data) should use uppercase underscore-separated ([screaming snake case](https://en.wikipedia.org/wiki/Snake_case)) names:
const val MAX_COUNT = 8
val USER_NAME_FIELD = "UserName"
クラス内で 2 つの類似した役割の変数名がある場合の対応。 基本的には変数名にアンダースコアを使わない方針で行う。
If a class has two properties which are conceptually the same but one is part of a public API and another is an implementation detail, use an underscore as the prefix for the name of the private property:
class C {
private val _elementList = mutableListOf<Element>()
val elementList: List<Element>
get() = _elementList
}
// Bad: arrayListOf() returns ArrayList<T>, which is a mutable collection type
val allowedValues = arrayListOf("a", "b", "c")
// Good: listOf() returns List<T>
val allowedValues = listOf("a", "b", "c")
Prefer declaring functions with default parameter values to declaring overloaded functions.
// Bad
fun foo() = foo("a")
fun foo(a: String) { /*...*/ }
// Good
fun foo(a: String = "a") { /*...*/ }
for (i in 0..n - 1) { /*...*/ } // bad
for (i in 0 until n) { /*...*/ } // good
役割: 検索バーにキーワードを入力して、検索結果を表示する
SearchScreenFragment
役割: 検索結果の詳細を表示する
SearchResultsDetailScreenFragment
すべて小文字を使い単語の区切りはアンダースコアを使うこと
android:id="@+id/searchInputLayout"
android:id="@+id/search_input_layout"
Local variable name '_viewModel' should start with a lowercase letter
対応内容が develop にマージされたため、本 ISSUE をクローズします。
新たに見つけた可読性の向上したい箇所の対応が完了し、develop にマージされたため、本 Issue をクローズします。
本プロジェクトのソースコードはとても読みにくいです。下記のリストを参考に読みやすいように修正してください。
参考:https://kotlinlang.org/docs/coding-conventions.html