.editorconfig if placed inside buildSrc resource/c...
# ktlint
r
.editorconfig if placed inside buildSrc resource/config/ktlint/.editorconfig not recognized by ktlint, Does anyone know if its necessary to put .editorconfig on root level of project to get its recognized, because i see there is no method where we can set .editorconfig path in ktlint, also i see when i put ktlint_code_style = intellij_idea inside .editorconfig its not recognized. ktlint version used is 1.1.4
p
The
.editorconfig
is applied on all files in the directory it is placed in, and on all its subdirectories. Si yeah, best place is to put in in the root of your project.
☝️ 1
r
ok, but is there a way we can specifically set the path for .editorconfig, seems like its not available
p
It will be picked up automatically. All directories on the path to a file are scanned for an
.editorconfig
file until such a file is found in which property
root = true
is set.
r
i havent put root = true since i havent put it on the root of project if i uderstood correctly root = true defines the position of config file, correct me if i am wrong, though i even put root = true when placed inside buildSrc/src/main/resources/config/ktlint/.editorconfig, didn't work
v
No, there is no way to configure it. The specification defines where the files must be: https://spec.editorconfig.org/#file-processing
☝️ 1
If you want to keep it at another place and only have it used on dedicated check activities you have to move or copy the file, do the check activity, and then move it back or delete it.
root = true
simply means do not search further up in the filesystem. This just typically is set at the root of a project, but theoretically you can set it anywhere it is appropriate for you.
👍 1