Skip to content

Commit

Permalink
Merge pull request #388 from shashachu/annotation-indent
Browse files Browse the repository at this point in the history
Include annotations in parameter indentation checks.
  • Loading branch information
shashachu authored Apr 22, 2019
2 parents 738bd90 + 260a977 commit 6d0a06f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.pinterest.ktlint.ruleset.experimental
import com.pinterest.ktlint.core.EditorConfig
import com.pinterest.ktlint.core.KtLint
import com.pinterest.ktlint.core.Rule
import com.pinterest.ktlint.core.ast.ElementType.ANNOTATION
import com.pinterest.ktlint.core.ast.ElementType.ARROW
import com.pinterest.ktlint.core.ast.ElementType.BINARY_EXPRESSION
import com.pinterest.ktlint.core.ast.ElementType.BINARY_WITH_TYPE
Expand Down Expand Up @@ -280,7 +281,7 @@ class IndentationRule : Rule("indent"), Rule.Modifier.RestrictToRootLast {
) {
for (c in node.children()) {
if (
(c.elementType == VALUE_PARAMETER || c.elementType == VALUE_ARGUMENT) &&
(c.elementType == VALUE_PARAMETER || c.elementType == VALUE_ARGUMENT || c.elementType == ANNOTATION) &&
c.textContains('\n')
) {
// rearrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@ class C (
}
}

class TestClass(
@Id @NotNull
@Column(
nullable = false
)
val id: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ class C (val a: Int, val b: Int, val e: (
}
}

class TestClass(
@Id @NotNull
@Column(
nullable = false
)
val id: String
)

0 comments on commit 6d0a06f

Please # to comment.