.editorconfig with empty values
When you export a code style config from IntelliJ to an .editorconfig file, there are several keys without value.
This makes the ktlint plugin 0.20.0-beta-4 not work anymore as it gets a parse exception from ec4j:
2023-12-01 16:51:13,882 [1216094] INFO - STDOUT - Start ktlintFormat on file '....kt' triggered by 'KtlintPostFormatProcessor'
2023-12-01 16:51:13,888 [1216100] SEVERE - #c.i.c.a.AbstractLayoutCodeProcessor - Got unexpected exception during formatting file://....kt
java.util.concurrent.ExecutionException: org.ec4j.core.parser.ParseException: path:.../.editorconfig:93:26: Property 'ij_java_builder_methods' has no value
Thanks for the report, @Vampire.
The editorconfig format specification is quite clear about the alowed structures in .editorconfig files:
Each line must be one of the following: ...
- Key-Value Pair (or Pair): contains a key and a value, separated by an =.
- Key: The part before the first = (trimmed of whitespace, but including any whitespace in the middle).
- Value: The part after the first = (trimmed of whitespace, but including any whitespace in the middle). Any line that is not one of the above is invalid.
I'd interpret it in such a way that keys without values are illegal and it is the IJ export that should be fixed.
I don't see how a value of "" (empty string) is not following that specification.
"Fixing" the IJ export is not as simple as it might sound, because it is also the interpretation.
A key with empty value is different from the key being absent.
I have filed a specs clarification issue https://github.com/editorconfig/editorconfig/issues/496
Soooo, the specification now is clarified by explicitly allowing empty values. Can we get a fix for this now? :-)
I released 1.1.0