-
Notifications
You must be signed in to change notification settings - Fork 510
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
Possibly bug with Params editorconfig handling #605
Comments
Before moving if (editorConfigPath != null) {
val userData = (
EditorConfig.of(File(editorConfigPath).canonicalPath)
?.onlyIf({ debug }) { printEditorConfigChain(it) }
?: emptyMap<String, String>()
) + cliUserData
return fun (fileName: String) = userData + ("file_path" to fileName)
} and |
Most likely this issue is obsolete due to changes in ktlint |
@ZacSweers How relevant is your question at this moment? I have been reading the spotless issue. If I understand correctly, the goal is that when Spotless invokes As you remarked in comment, ktlint needs to know the path of the file so that it can check which In case I am open for suggestions to improve the API of ktlint but at this moment I can not figure out what Spotless's needs are given the current state of both Spotless and KtLint. One possibily could be that the singular Another possibility is that an API is added which, given a directory path creates an instance of the EditorConfigOverride based on the '.editorConfig' files which then can be supplierd to calls of |
Sorry I no longer use ktlint, so I don't think I have any helpful input |
Ok, tnx for replying. I have updated the spotless issue to inform other participants about status in ktlint. Closing this issue for now. |
I've been working on adding editorconfig support to the Spotless gradle plugin, but I believe I'm hitting an issue due to this line:
https://github.com/pinterest/ktlint/blob/master/ktlint-core/src/main/kotlin/com/pinterest/ktlint/core/KtLint.kt#L178
If the input file name doesn't match (such as if it's null), it will ignore the editorconfig that was passed in and return an empty map. My sense is that this was an oversight and it should just return the parsed mapping just without the
file_name
added to it. Before I make a PR I wanted to confirm if this was the case, or understand better why if it's intentional.This presents an issue for spotless because it doesn't currently pass in the file name to the format call, just the contents. It might be possible to change this if need be (and maybe should be the case for other rules that depend on
file_name
), but that's the current reason this can't be simply worked around.The text was updated successfully, but these errors were encountered: