You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is slightly annoying on its own, but then this bug seems to interact with other indentation issues (possibly #764 or #805) where IDEA and ktlint's formatting rules don't match each other. IntelliJ IDEA's formatter (with the default applyToIDEAProject settings) will reformat the file to:
/path/to/Example.kt:6:1: Unexpected indentation (8) (should be 12) (indent)
Subsequent ktlint/IDEA formats will cycle between these two indentations.
Steps to Reproduce
The above code sample should suffice for reproduction.
Your Environment
Version of ktlint used: 0.38.1
Name and version (or code for custom task) of integration used): Gradle plugin 9.4.0
Version of Gradle used (if applicable): 5.6.2
Operating System and version: Mac OS X 10.15.6 x86_64
Related Issues
I know #764, #805, and some other issues cover bugs around the new indent rule. I couldn't tell immediately whether this issue should be folded into one of those or stand on its own. I think an important distinction is that, regardless of the bugs ktlint has around formatting multi-line raw strings, the main problem I want to cover with this ticket is that a short raw string should be allowed to be on a single line when used as a named argument.
Additionally, I think this bug is another good reason to prioritize #631. I wouldn't mind this bug nearly as much if I had a simple way to ignore it the indent rules for a given line or block.
The text was updated successfully, but these errors were encountered:
While doing a workaround for this (extracting my raw string to a variable, so I could pass the variable instead of it being defined inline), I noticed ktlint also turns:
constvalEMAIL_RE="""^[^\s@]+@[^\s@]+\.[^\s@]+$"""
Into:
constvalEMAIL_RE="""^[^\s@]+@[^\s@]+\.[^\s@]+$"""
I'm not sure if this is a bug or intentional (I can't find any style guide reference indicating raw strings should be defined on their own line). Thankfully, IDEA doesn't try to further reformat that code, so it still works as a workaround for now.
Expected Behavior
The following code should lint without complaints:
Observed Behavior
ktlint complains with the following error:
ktlint format will then reformat the code to:
This is slightly annoying on its own, but then this bug seems to interact with other indentation issues (possibly #764 or #805) where IDEA and ktlint's formatting rules don't match each other. IntelliJ IDEA's formatter (with the default
applyToIDEAProject
settings) will reformat the file to:Which then causes another complaint from ktlint:
Subsequent ktlint/IDEA formats will cycle between these two indentations.
Steps to Reproduce
The above code sample should suffice for reproduction.
Your Environment
Related Issues
I know #764, #805, and some other issues cover bugs around the new indent rule. I couldn't tell immediately whether this issue should be folded into one of those or stand on its own. I think an important distinction is that, regardless of the bugs ktlint has around formatting multi-line raw strings, the main problem I want to cover with this ticket is that a short raw string should be allowed to be on a single line when used as a named argument.
Additionally, I think this bug is another good reason to prioritize #631. I wouldn't mind this bug nearly as much if I had a simple way to ignore it the indent rules for a given line or block.
The text was updated successfully, but these errors were encountered: