Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 890 Bytes

MultilineRawStringIndentation.md

File metadata and controls

42 lines (30 loc) · 890 Bytes

Pattern: Inconsistent multiline raw string indentation

Issue: -

Description

This rule ensures that raw strings have a consistent indentation.

The content of a multi line raw string should have the same indentation as the enclosing expression plus the configured indentSize. The closing triple-quotes (""") must have the same indentation as the enclosing expression.

Example of incorrect code:

val a = """
Hello World!
How are you?
""".trimMargin()

val a = """
        Hello World!
        How are you?
        """.trimMargin()

Example of correct code:

val a = """
    Hello World!
    How are you?
""".trimMargin()

val a = """
    Hello World!
      How are you?
""".trimMargin()

Further Reading