blob: 628d50b84cb4d425b1db8e0d4936ff1e8686d5ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# frozen_string_literal: true
module Gitlab
module Ci
module Parsers
module Codequality
class CodeClimate
def parse!(json_data, codequality_report)
root = Gitlab::Json.parse(json_data)
parse_all(root, codequality_report)
rescue JSON::ParserError => e
codequality_report.set_error_message("JSON parsing failed: #{e}")
end
private
def parse_all(root, codequality_report)
return unless root.present?
root.each do |degradation|
break unless codequality_report.add_degradation(degradation)
end
end
end
end
end
end
end
|