From dfe2cc0ef5e6dba8a0c29ebe5364667a62abbd19 Mon Sep 17 00:00:00 2001 From: David Renz Date: Thu, 28 Apr 2016 18:51:38 +0200 Subject: [PATCH] Fixed the CodeClimate renderer - Cut off the "/Code/" working directory of CodeClimate engines in order to get the relative path. --- .../net/sourceforge/pmd/renderers/CodeClimateIssue.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/renderers/CodeClimateIssue.java b/pmd-core/src/main/java/net/sourceforge/pmd/renderers/CodeClimateIssue.java index 0856d706ff..ffaf12a60a 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/renderers/CodeClimateIssue.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/renderers/CodeClimateIssue.java @@ -32,7 +32,13 @@ public class CodeClimateIssue { } public Location(String path, int beginLine, int endLine) { - this.path = path; + // Note: required by CodeClimate - Cut off the "/Code/" working directory of CodeClimate engines in order to get the relative path. + if(path.startsWith("/code/")) { + this.path = path.substring(6); + } else { + this.path = path; + } + this.lines = new Lines(); lines.begin = beginLine; lines.end = endLine;