Closed Rshalika closed 4 months ago
The baseline file is generated from the active directory where the command is executed. If you run the ktlintGenerateBaseline
in the app
project, it is logical that the baseline file is created inside the app
project. I would expect the ktlintGenerateBaseline
to be available in the root project as well. So try to run it from the root-project.
I think it is a responsibility of the Ktlint integrators to ensure compatibility with ktlint. So in case of further question about this topic, please contact maintainers of the ktlint-gradle
project first.
Thanks for the response. In their readme they mention that the baseline file is supported with some limitations.
One baseline file is generated per one Gradle project (module).
So the formatting is always file name="src/androidTest/java/com/circula/MyTestRunner.kt
(I tried tunning it from a different directory but the same result)
In general, should the baseline file always have this formatting?
<file name="app/src/androidTest/java/com/circula/MyTestRunner.kt">
(File paths starting from root directory)
Is it supported to have multiple baseline files per module? What are the limitations when it comes to the baseline file location, format, and number of them?
Thanks again!
You're in the wrong repository with this question. Both ktlint-intelli-plugin
and 'ktlint-gradleare based on
ktlint`.
As I am maintainer of ktlint
as well, I will anser anyway.
Ktlint does (and will) not support multiple baseline files. As I said in the earlier comment, it is the responsibility of the integrator to use the ktlint functionality as is intended. You can workaround this problem by using Ktlint CLI to generate the baseline file in the root directory.
In my Android project, I want to use ktlint-intellij-plugin. As I know ktlint-intellij-plugin requires a baseline file to be generated from the root directory of the project, but ktlint-gradle generates it inside the app module. (Using ktlintGenerateBaseline task)
It is not about file location, I can configure the IDE plugin to look at the file in the app module, but individual baseline entries have their relative paths starting from the app module instead of the root directory.
For example, This is a file compatible with the IDE plugin
But ktlintGenerateBaseline generates this
Note
app/src/androidTest
vssrc/androidTest
Is there a way to make these two work together?
In general, when I am using the IDE plugin what is a recommended gradle integration to work with? Are there any best practices?
Thanks!