Also it says “When `filePath` is provided , the .e...
# ktlint
m
Also it says “When
filePath
is provided , the .editorconfig` files on the path are taken into account”. So it would seem some checking of the files in that folder would happen at a minimum. Since I am providing a fake file path “file.kts” I would not want any checking like this to occur
p
That will happen anyway but it is very lightweight. Checking is done based on the directory name and KtLint has an internal cache to store the editorconfig files. So in answer on your previous question(s), the (dummy) filename should point at the directory in which potentially the
.editorconfig
of the project can be found.
m
In my case, I am using ktlint to format kotlin or kts snippets. So there is not necessarily any project.
p
What is the context of your problem? Why do you have snippets that do not belong to a project?
m
I’m generating kotlin code that eventually gets written to files as part of my workflow in various ways
After generating the kotlin code, I try to pass it through ktlint to format it
p
Just try it out please. I do not think that you will notice delays due to file access as there is already quite some file processing going on in older releases as well. I don’t want to optimise if there is no significant measurable delay.
m
Sure. I’m happy to try it and not too worried. I am much less worried about performance. My larger concern is that its just a little confusing to pass a fake file path into a function, since it suggests IO or interaction with a filesystem in contexts where we might not want any
But if I’m the only person concerned about this, no worries
p
The concern about the API not being clear about this, is still valid. So either it need to be clarified or an additional API has to be provided which is clear.
m