kokoichi206 / android-engineer-codecheck

Apache License 2.0
0 stars 0 forks source link

ソースコードの可読性の向上 #1

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

本プロジェクトのソースコードはとても読みにくいです。下記のリストを参考に読みやすいように修正してください。

参考:https://kotlinlang.org/docs/coding-conventions.html

kokoichi206 commented 1 year ago

Coding Rule について

基本的には IntelliJ のコードフォーマットを適応していると、Kotlin Coding Conventions に従ったことになる。

Screenshot 2022-12-01 at 8 34 02

ブラケット位置

open curly brace ではなく以下のルールが基本みたい

For curly braces, put the opening brace in the end of the line where the construct begins, and the closing brace on a separate line aligned horizontally with the opening construct.

if (elements != null) {
    for (element in elements) {
        // ...
    }
}

class-header については、open curly brace もあってもいいみたい。

To clearly separate the class header and body when the class header is long, either put a blank line following the class header (as in the example above), or put the opening curly brace on a separate line:

class MyFavouriteVeryLongClassHolder :
    MyLongHolder<MyFavouriteVeryLongClass>(),
    SomeOtherInterface,
    AndAnotherOne
{
    fun foo() { /*...*/ }
}