Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ktlint reporters generate empty files #206

Closed
ghost opened this issue Apr 3, 2019 · 2 comments · Fixed by #208
Closed

ktlint reporters generate empty files #206

ghost opened this issue Apr 3, 2019 · 2 comments · Fixed by #208

Comments

@ghost
Copy link

ghost commented Apr 3, 2019

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

freemanjp added a commit that referenced this issue Apr 4, 2019
It was overwriting the file for each source directory (main, test etc.).

Bug fix: resolves #206
freemanjp added a commit that referenced this issue Apr 4, 2019
It was overwriting the file for each source directory (main, test etc.).

Bug fix: resolves #206
@freemanjp
Copy link
Member

@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.

@ghost
Copy link
Author

ghost commented Apr 5, 2019

Thanks for fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant