xcpretty-pmd-formatter 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pmd_formatter.rb +42 -26
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf0585341c17f83f2b221be685f1c90718496080
|
4
|
+
data.tar.gz: d611f313a2774760c8348af100e26589edf90724
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b7f3fef5fc71f0fb28d2fe978748a3cea26d163dc084236fe76df35583e8b87a9a883c15dae3495223c8c083b274c5641db0075d4132f0a5b28ed43812be311
|
7
|
+
data.tar.gz: 7410723a3f0c7a4e9099358ad28dfbbe9884f902a9b753d848aee8c6d33e8fa1b143f4f03f00dcb646cf1161d29a6d32db899ac3df07b8f8c73bb57ff7db3934
|
data/lib/pmd_formatter.rb
CHANGED
@@ -130,35 +130,51 @@ class PMDFormatter < XCPretty::Simple
|
|
130
130
|
file_node = XML::Node.new('file')
|
131
131
|
violation = XML::Node.new('violation')
|
132
132
|
array.each do |x|
|
133
|
-
x.
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
133
|
+
if x.kind_of?(Hash)
|
134
|
+
x.each do |key, value|
|
135
|
+
if key.to_s == 'file_path'
|
136
|
+
file_node = XML::Node.new('file')
|
137
|
+
file_node['name'] = value.split(':')[0]
|
138
|
+
violation = XML::Node.new('violation')
|
139
|
+
violation['begincolumn'] = value.split(':')[2]
|
140
|
+
violation['endcolumn'] = '0'
|
141
|
+
violation['beginline'] = value.split(':')[1]
|
142
|
+
violation['endline'] = '0'
|
143
|
+
end
|
144
|
+
if key1.to_s == 'compile_errors'
|
145
|
+
violation['priority'] = '1'
|
146
|
+
else
|
147
|
+
violation['priority'] = '2'
|
148
|
+
end
|
149
|
+
violation['rule'] = 'clang static analyzer'
|
150
|
+
violation['ruleset'] = 'clang static analyzer'
|
151
|
+
if key.to_s == 'reason'
|
152
|
+
violation.content = value
|
153
|
+
end
|
154
|
+
has_everything = !violation.parent && violation['begincolumn']
|
155
|
+
has_everything &&= violation['endcolumn']
|
156
|
+
has_everything &&= violation['beginline'] && violation['endline'] && violation.content
|
157
|
+
if has_everything
|
158
|
+
file_node << violation
|
159
|
+
end
|
160
|
+
if file_node['name']
|
161
|
+
doc.root << file_node
|
162
|
+
end
|
147
163
|
end
|
164
|
+
elsif x.kind_of?(String)
|
165
|
+
file_node = XML::Node.new('file')
|
166
|
+
file_node['name'] = ''
|
167
|
+
violation = XML::Node.new('violation')
|
168
|
+
violation['begincolumn'] = '0'
|
169
|
+
violation['endcolumn'] = '0'
|
170
|
+
violation['beginline'] = '0'
|
171
|
+
violation['endline'] = '0'
|
172
|
+
violation['priority'] = '2'
|
148
173
|
violation['rule'] = 'clang static analyzer'
|
149
174
|
violation['ruleset'] = 'clang static analyzer'
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
has_everything = !violation.parent && violation['begincolumn']
|
154
|
-
has_everything &&= violation['endcolumn']
|
155
|
-
has_everything &&= violation['beginline'] && violation['endline'] && violation.content
|
156
|
-
if has_everything
|
157
|
-
file_node << violation
|
158
|
-
end
|
159
|
-
if file_node['name']
|
160
|
-
doc.root << file_node
|
161
|
-
end
|
175
|
+
violation.content = x
|
176
|
+
file_node << violation
|
177
|
+
doc.root << file_node
|
162
178
|
end
|
163
179
|
end
|
164
180
|
end
|