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
Note that the ktlint-based MaximumLineLength is reported at line 39 (wrong), but the detekt-based MaxLineLength is reported at line 41 (correct) for the same file.
Also, running stand-alone ktlint 0.34.2 correctly reports 41, so the issue is with detekt, not with ktlint.
All detekt-formatting rules are reported with slightly wrong positions - #2120.
arturbosch
changed the title
MaximumLineLength reported at wrong line
Formatting rules are reported at wrong line (e.g. MaximumLineLength)
Nov 23, 2019
Oh! Should detekt then maybe say "approximate line X" for these rules to avoid confusion?
Hm, I think as most users use the autoCorrect for this it's not that big of an issue.
However we need to debug why we report them wrongly.
For detekt-rules we use the kotlin compilers method to transform line endings. KtLint uses own method to do this. For detekt-formatting we combine both methods which I think is the reason for this.
Expected Behavior
I expect MaximumLineLength to be reported at the line it occurred.
Observed Behavior
MaximumLineLength is reported at
<correct line> - 2
(in my case).Steps to Reproduce
detekt-issue-1843
branch../gradlew :scanner:detekt
.Note that the ktlint-based MaximumLineLength is reported at line 39 (wrong), but the detekt-based MaxLineLength is reported at line 41 (correct) for the same file.
Also, running stand-alone ktlint 0.34.2 correctly reports 41, so the issue is with detekt, not with ktlint.
Context
Might be related to #1688.
Your Environment
The text was updated successfully, but these errors were encountered: