Skip to content

Commit 2ae8e5e

Browse files
committed
Don't create empty code quality reports
1 parent e75e216 commit 2ae8e5e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/main/java/de/chkal/maven/gitlab/codequality/GenerateMojo.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,14 @@ public void execute() throws MojoExecutionException, MojoFailureException {
6060
}
6161

6262
// Create GitLab report
63-
try (FileOutputStream stream = new FileOutputStream(outputFile)) {
64-
new ReportSerializer().write(findings, stream);
65-
log.info("GitLab code quality report containing {} issue created: {}",
66-
findings.size(), outputFile);
67-
} catch (IOException e) {
68-
throw new IllegalStateException(e);
63+
if (findings.size() > 0) {
64+
try (FileOutputStream stream = new FileOutputStream(outputFile)) {
65+
new ReportSerializer().write(findings, stream);
66+
log.info("GitLab code quality report containing {} issue created: {}",
67+
findings.size(), outputFile);
68+
} catch (IOException e) {
69+
throw new IllegalStateException(e);
70+
}
6971
}
7072

7173
}

0 commit comments

Comments
 (0)