View Javadoc
1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   
5   package net.sourceforge.pmd.renderers;
6   
7   import net.sourceforge.pmd.*;
8   
9   /**
10   * Structure for the Code Climate Issue spec (https://github.com/codeclimate/spec/blob/master/SPEC.md#issues)
11   */
12  public class CodeClimateIssue {
13      public final String type = "issue";
14      public String check_name;
15      public String description;
16      public Content content;
17      public final String[] categories = { "Style" };
18      public Location location;
19      public String severity;
20  
21      /**
22       * Location structure
23       */
24      public static class Location {
25          public String path;
26          public Lines lines;
27  
28          private class Lines {
29              public int begin;
30              public int end;
31          }
32  
33          public Location(String path, int beginLine, int endLine) {
34              this.path = path;
35              this.lines = new Lines();
36              lines.begin = beginLine;
37              lines.end = endLine;
38          }
39      }
40  
41      /**
42       * Content structure
43       */
44      public static class Content {
45          public String body;
46  
47          /**
48           * Strip out all newlines from the body
49           * @param {String} body The text to compose the content from
50           */
51          public Content(String body) {
52              this.body = body.replace(PMD.EOL, " ");
53          }
54      }
55  }