How to make ktlint-gradle work with Ktlint - IntelliJ IDEs Plugin. Including baseline support

59 Views Asked by At

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.

0

There are 0 best solutions below