xcpretty-pmd-formatter 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/pmd_formatter.rb +39 -35
- 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: ec36e1232cb11b638da63719a419979865997236
|
4
|
+
data.tar.gz: 614b6dcf2a8816aa61d121e515c80d630e206c8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d14771ae44d95a8363e0ec980d1ab95b661d1790fdb35c2f343f339581a4332ac1a62f668a8b8b1dcf582530164e1df5b262b1bbbdcc06e68824b2109f664bfc
|
7
|
+
data.tar.gz: 4c6939f002cf9f386c08a5fad9ce695020307053dc45ca2a1a45cf0936e50927e172d47f6f0d9557147418bce02acd355b5ca052df9acd98cebef2fe7439f94a
|
data/lib/pmd_formatter.rb
CHANGED
@@ -122,41 +122,45 @@ class PMDFormatter < XCPretty::Simple
|
|
122
122
|
rootnode = XML::Node.new('pmd')
|
123
123
|
rootnode['version'] = 'xcpretty-pmd-formatter'
|
124
124
|
doc.root = rootnode
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
125
|
+
|
126
|
+
pmd_output.each do |key1, array|
|
127
|
+
unless array.count
|
128
|
+
next
|
129
|
+
end
|
130
|
+
file_node = XML::Node.new('file')
|
131
|
+
violation = XML::Node.new('violation')
|
132
|
+
array.each do |x|
|
133
|
+
x.each do |key, value|
|
134
|
+
if key.to_s == 'file_path'
|
135
|
+
file_node = XML::Node.new('file')
|
136
|
+
file_node['name'] = value.split(':')[0]
|
137
|
+
violation = XML::Node.new('violation')
|
138
|
+
violation['begincolumn'] = value.split(':')[2]
|
139
|
+
violation['endcolumn'] = '0'
|
140
|
+
violation['beginline'] = value.split(':')[1]
|
141
|
+
violation['endline'] = '0'
|
142
|
+
end
|
143
|
+
violation['priority'] = '1'
|
144
|
+
violation['rule'] = 'clang static analyzer'
|
145
|
+
violation['ruleset'] = 'clang static analyzer'
|
146
|
+
if key.to_s == 'reason'
|
147
|
+
violation.content = value
|
148
|
+
end
|
149
|
+
has_everything = !violation.parent && violation['begincolumn']
|
150
|
+
has_everything &&= violation['endcolumn']
|
151
|
+
has_everything &&= violation['beginline'] && violation['endline'] && violation.content
|
152
|
+
if has_everything
|
153
|
+
file_node << violation
|
154
|
+
end
|
155
|
+
if file_node['name']
|
156
|
+
doc.root << file_node
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
doc_as_str = doc.to_s
|
162
|
+
# puts doc_as_str
|
163
|
+
File.write(file_name, doc_as_str)
|
160
164
|
end
|
161
165
|
end
|
162
166
|
|