saveourtool/diktat

Multiline strings and concatenation of strings

Open

#988 opened on Jul 16, 2021

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Kotlin (40 forks)github user discovery
enhancementgood first issuehelp wantedneeded

Repository metrics

Stars
 (571 stars)
PR merge metrics
 (PR metrics pending)

Description

A lot of people follow java style and write the following code in Kotlin:

val a = "aaa \n" +
           "bbb \n" +
           "ccc \n" 

We can make it look much better in kotlin like style:

val a = """
    |aaa
    |bbb
    |ccc
“””.trimMargin()

Diktat should be able to raise warnings in such case if the default mode is used. In fix mode (with -F option) it should automatically fix such code.

Contributor guide