Formatting Rule Set
This rule set provides wrappers for rules implemented by ktlint - https://ktlint.github.io/.
Note: Issues reported by this rule set can only be suppressed on file level (@file:Suppress("detekt.rule")
).
Note: The formatting rule set is not included in the detekt-cli or gradle plugin.
To enable this rule set, add detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:$version"
to your gradle dependencies or reference the detekt-formatting
-jar with the --plugins
option
in the command line interface.
AnnotationOnSeparateLine
See ktlint docs for documentation.
Active by default: Yes - Since v1.22.0
AnnotationSpacing
See ktlint docs for documentation.
Active by default: Yes - Since v1.22.0
ArgumentListWrapping
See ktlint docs for documentation.
Active by default: Yes - Since v1.22.0
Configuration options:
-
indentSize
(default:4
)indentation size
-
maxLineLength
(default:120
) (android default:100
)maximum line length
BlockCommentInitialStarAlignment
See ktlint docs for documentation.
Active by default: No
ChainWrapping
See ktlint docs for documentation.
Active by default: Yes - Since v1.0.0
CommentSpacing
See ktlint docs for documentation.
Active by default: Yes - Since v1.0.0
CommentWrapping
See ktlint docs for documentation.
Active by default: No
Configuration options:
-
indentSize
(default:4
)indentation size
DiscouragedCommentLocation
See ktlint docs for documentation.
Active by default: No
EnumEntryNameCase
See ktlint docs for documentation.
Active by default: Yes - Since v1.22.0
Filename
See ktlint docs for documentation.
This rules overlaps with naming>MatchingDeclarationName from the standard rules, make sure to enable just one.
Active by default: Yes - Since v1.0.0
FinalNewline
See ktlint docs for documentation.
This rules overlaps with style>NewLineAtEndOfFile from the standard rules, make sure to enable just one. The pro of this rule is that it can auto-correct the issue.
Active by default: Yes - Since v1.0.0
Configuration options:
-
insertFinalNewLine
(default:true
)report absence or presence of a newline
FunKeywordSpacing
See ktlint docs for documentation.
Active by default: No
FunctionReturnTypeSpacing
See ktlint docs for documentation.
Active by default: No