Reputation: 21
In my android project I want to use Ktlint - IntelliJ IDEs Plugin. This 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 start from the app
module instead of the root directory.
For example: This is a file compatible with IDE plugin
<?xml version="1.0" encoding="utf-8"?>
<baseline version="1.0">
<file name="app/src/androidTest/java/com/circula/MyTestRunner.kt">
<error line="8" column="19" source="standard:colon-spacing" />
</file>
</baseline>
But ktlintGenerateBaseline
generates this
<?xml version="1.0" encoding="utf-8"?>
<baseline version="1.0">
<file name="src/androidTest/java/com/circula/MyTestRunner.kt">
<error line="8" column="19" source="standard:colon-spacing" />
</file>
</baseline>
Note app/src/androidTest
vs src/androidTest
Is there a way to make these two work together?
Thanks.
Upvotes: 1
Views: 411
Reputation: 10761
Move the baseline file to the app folder instead. And then reference it in the gradle plugin like:
ktlint {
...
baseline = file("ktlint-baseline.xml")
}
./gradlew ktlintCheck
will not show anything that you have in the baseline anymore.
Not exactly what you wanted but at least something. This is how I ended up solving it.
Upvotes: 0