gantsign / ktlint-maven-plugin

Maven plugin for ktlint the Kotlin linter

Home Page:http://gantsign.com/ktlint-maven-plugin/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ktlint reporters generate empty files

opened this issue · comments

Hi there,

I have an issue with generating checkstyle reports from ktlint. My Maven configuration for the ktlint-maven-plugin looks as follows:

<plugin>
    <groupId>com.github.gantsign.maven</groupId>
     <artifactId>ktlint-maven-plugin</artifactId>
     <executions>
         <execution>
             <id>checkstyle</id>
             <goals>
                 <goal>check</goal>
             </goals>
             <configuration>
                <failOnViolation>false</failOnViolation>
                <reporters>
                    <reporter>
                        <name>checkstyle</name>
                        <output>${project.build.directory}/checkstyle-ktlint.xml</output>
                    </reporter>
                 </reporters>
             </configuration>
        </execution>
    </executions>
</plugin>

During the execution of my build I can see error messages from ktlint in the console output:

[ERROR] src\main\kotlin\com\bbraun\cit\dlm\validation\ValidatableXmlAdapter.kt:5:40: Missing spacing before ":"
[ERROR] src\main\kotlin\com\bbraun\cit\dlm\validation\ValidatableXmlAdapter.kt:12:31: Missing spacing before ":"
[ERROR] src\main\kotlin\com\bbraun\cit\dlm\validation\ValidationError.kt:13:1: Needless blank line(s)

But the resulting output file checkstyle-ktlint.xml does not contain any entries:

<?xml version="1.0" encoding="utf-8"?>
<checkstyle version="8.0">
</checkstyle>

I also tried the plain reporter but the resulting text file was empty also.

Do you have an idea on what could be the reason for this?

Thanks in advance

Jens

@jsiebert, thanks for reporting this issue. It was a bug where the file was being written/overwritten multiple times with partial/empty results. This issue is resolve by #208. You can find this fix in the 0.9.24 release of this plugin.

Thanks for fixing this!