@@ -31,35 +31,37 @@ func NewCodeClimate(log logutils.Log, w io.Writer) *CodeClimate {
31
31
}
32
32
33
33
func (p * CodeClimate ) Print (issues []result.Issue ) error {
34
- codeClimateIssues := make ([]CodeClimateIssue , 0 , len (issues ))
34
+ ccIssues := make ([]codeClimateIssue , 0 , len (issues ))
35
35
36
36
for i := range issues {
37
37
issue := issues [i ]
38
38
39
- codeClimateIssue := CodeClimateIssue {}
40
- codeClimateIssue .Description = issue .Description ()
41
- codeClimateIssue .CheckName = issue .FromLinter
42
- codeClimateIssue .Location .Path = issue .Pos .Filename
43
- codeClimateIssue .Location .Lines .Begin = issue .Pos .Line
44
- codeClimateIssue .Fingerprint = issue .Fingerprint ()
45
- codeClimateIssue .Severity = p .sanitizer .Sanitize (issue .Severity )
39
+ ccIssue := codeClimateIssue {
40
+ Description : issue .Description (),
41
+ CheckName : issue .FromLinter ,
42
+ Severity : p .sanitizer .Sanitize (issue .Severity ),
43
+ Fingerprint : issue .Fingerprint (),
44
+ }
46
45
47
- codeClimateIssues = append (codeClimateIssues , codeClimateIssue )
46
+ ccIssue .Location .Path = issue .Pos .Filename
47
+ ccIssue .Location .Lines .Begin = issue .Pos .Line
48
+
49
+ ccIssues = append (ccIssues , ccIssue )
48
50
}
49
51
50
52
err := p .sanitizer .Err ()
51
53
if err != nil {
52
54
p .log .Infof ("%v" , err )
53
55
}
54
56
55
- return json .NewEncoder (p .w ).Encode (codeClimateIssues )
57
+ return json .NewEncoder (p .w ).Encode (ccIssues )
56
58
}
57
59
58
- // CodeClimateIssue is a subset of the Code Climate spec.
60
+ // codeClimateIssue is a subset of the Code Climate spec.
59
61
// https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#data-types
60
62
// It is just enough to support GitLab CI Code Quality.
61
63
// https://docs.gitlab.com/ee/ci/testing/code_quality.html#code-quality-report-format
62
- type CodeClimateIssue struct {
64
+ type codeClimateIssue struct {
63
65
Description string `json:"description"`
64
66
CheckName string `json:"check_name"`
65
67
Severity string `json:"severity,omitempty"`
0 commit comments