-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing newline after "{" (wrapping)
false positive on line that has exactly 140 characters
#1808
Comments
This seems to be an error in the |
…ving exactly the maximum line length is preceded by a blank line Closes #1808
…ving exactly the maximum line length is preceded by a blank line Closes #1808
* Fix false positive when a single line statement containing a block having exactly the maximum line length is preceded by a blank line Closes #1808
ktlint-gradle: Btw, I'm receiving the message |
Tnx for the suggestion. It is a bit problematic to implement in the WrappingRule as there are different reasons why a linebreak is needed and only of them is related to exceeding the maximum line length. Personally, I use the linting only to debug problems in KtLint and for resolving lint-errors that can not be fixed automatically. In all other cases I just trust the formatting of KtLint blindly. If you want to try to implement this in KtLint, please give it a try and submit a PR. |
Expected Behavior
I'd either expect the ktlint to not report
wrapping
offence, or keep reporting the offence when an unrelated piece of code changes.IntelliJ doesn't perform any fixes when reformatting, the line that has 140 characters is considered valid
Observed Behavior
ktlint fails with
ktlint src/main/kotlin --log-level=debug
Steps to Reproduce
Given Kotlin file with line that has exactly 140 characters
and
.editorconfig:
withmax_line_length
set:When
ktlint
- it fails withwrapping
requirement being not met.package
definition - it passes$workProjct
where I originally stumbled upon this issue, adding one more character (so the line has now 141 chars) - I only sawmax_line_lenght
offence only (I wasn't able to repro here though)So either 1) is a false positive, or 2) and 3) are false negatives. I'm not sure what's the intended behavior here 👀
Your Environment
0.48.2
.editorconfig
settings:max_line_length = 140
ubuntu-latest
on GAThe text was updated successfully, but these errors were encountered: