Skip to content
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

Generated .editorconfig contains invalid max_line_length value #1824

Closed
magneticflux- opened this issue Feb 15, 2023 · 1 comment · Fixed by #1825
Closed

Generated .editorconfig contains invalid max_line_length value #1824

magneticflux- opened this issue Feb 15, 2023 · 1 comment · Fixed by #1825

Comments

@magneticflux-
Copy link

Expected Behavior

The default value of the standard max_line_length property is a positive integer or off according to the documentation.

Observed Behavior

When running ktlint generateEditorConfig without any options set, the produced (default) file contains max_line_length = -1. This causes IntelliJ to freak out and try to shrink every line as much as possible (since every line always has more than "-1" characters).

Steps to Reproduce

Run ktlint generateEditorConfig in a new IntelliJ project and use the output.

Your Environment

  • Version of ktlint used: 0.48.2
  • Relevant parts of the .editorconfig settings: max_line_length
  • Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): N/A
  • Version of Gradle used (if applicable): N/A
  • Operating System and version: Windows 11

The current editorconfig-related code already parses off values correctly as seen here:


but on output it writes the invalid value -1.

Additionally, the documentation mentions the off value here, and incorrectly states that -1 is a valid alternative.

Finally, I found a reference to the invalid -1 value in this issue comment: #659 (comment)

@magneticflux- magneticflux- changed the title Generated .editorconfig contains invalid values Generated .editorconfig contains invalid max_line_length value Feb 15, 2023
@paul-dingemans
Copy link
Collaborator

Most likely this setting has worked in the past for IntelliJ. But at least since IntelliJ IDEA 2022.2 this is indeed not working as expected. As of that the generated .editorconfig should not suggest the value -1 to be used but off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants