author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 29 Jul 2013 13:22:25 +0200 | |
changeset 193 | 9171e507b523 |
parent 192 | c1bb8ec592e1 |
child 213 | 2c6346e43dc0 |
permissions | -rw-r--r-- |
167 | 1 |
"{ Package: 'stx:goodies/builder/reports' }" |
2 |
||
3 |
"{ NameSpace: Builder }" |
|
4 |
||
5 |
ReportFormat subclass:#CoverageReportFormat |
|
6 |
instanceVariableNames:'' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'Builder-Reports-Formats' |
|
10 |
! |
|
11 |
||
12 |
CoverageReportFormat subclass:#Cobertura |
|
183
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
13 |
instanceVariableNames:'currentPackage currentClass currentClassLinesBuffer currentMethod |
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
14 |
infos' |
167 | 15 |
classVariableNames:'' |
16 |
poolDictionaries:'' |
|
17 |
privateIn:CoverageReportFormat |
|
18 |
! |
|
19 |
||
193
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
20 |
Parser subclass:#MethodAnalyzer |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
21 |
instanceVariableNames:'intervals branches' |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
22 |
classVariableNames:'' |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
23 |
poolDictionaries:'' |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
24 |
privateIn:CoverageReportFormat::Cobertura |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
25 |
! |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
26 |
|
167 | 27 |
|
28 |
!CoverageReportFormat class methodsFor:'testing'! |
|
29 |
||
30 |
isAbstract |
|
31 |
||
32 |
^self == CoverageReportFormat |
|
33 |
||
34 |
"Created: / 04-08-2011 / 11:44:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
35 |
"Modified: / 25-06-2013 / 01:26:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
36 |
! ! |
|
37 |
||
38 |
!CoverageReportFormat::Cobertura class methodsFor:'accessing'! |
|
39 |
||
40 |
symbolicNames |
|
41 |
"Returns a collection of symbolic names for this format" |
|
42 |
||
43 |
^ self shouldImplement |
|
44 |
! ! |
|
45 |
||
46 |
!CoverageReportFormat::Cobertura class methodsFor:'documentation'! |
|
47 |
||
48 |
documentation |
|
49 |
" } |
|
50 |
||
51 |
Replace 'Object', 'NewClass1' and |
|
52 |
the empty string arguments by true values. |
|
53 |
||
54 |
Install (or change) the class by 'accepting', |
|
55 |
either via the menu or the keyboard (usually CMD-A). |
|
56 |
||
57 |
You can also change the category simply by editing |
|
58 |
the categoryString and accepting. |
|
59 |
||
60 |
To be nice to others (and yourself later), do not forget to |
|
61 |
add some documentation; preferably under the classes documentation |
|
62 |
protocol. |
|
63 |
(see the `create documentation stubs' item in the methodList menu; |
|
64 |
switch from instance to class to find this menu item.) |
|
65 |
||
66 |
Notice, that ST/X uses the convention to document the class using |
|
67 |
comment-only class methods (however, ST80 comments are supported and |
|
68 |
can be changed via the class-documentation menu). |
|
69 |
||
70 |
" |
|
71 |
! ! |
|
72 |
||
73 |
!CoverageReportFormat::Cobertura methodsFor:'accessing - defaults'! |
|
74 |
||
75 |
defaultFileSuffix |
|
76 |
"superclass Builder::ReportFormat says that I am responsible to implement this method" |
|
77 |
||
78 |
^ 'xml' |
|
79 |
||
80 |
"Modified: / 25-06-2013 / 02:02:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
81 |
! ! |
|
82 |
||
83 |
!CoverageReportFormat::Cobertura methodsFor:'writing'! |
|
84 |
||
85 |
write: instrumentedMethods |
|
86 |
| packageMap | |
|
87 |
||
88 |
packageMap := Dictionary new. |
|
89 |
infos := Dictionary new. |
|
90 |
instrumentedMethods do:[:method| |
|
183
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
91 |
| classMap methodSet | |
167 | 92 |
classMap := packageMap at: method package ifAbsentPut: [ Dictionary new ]. |
186
b53f4cc947e1
Improvements in coverage - exclude accessors and metadata methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
183
diff
changeset
|
93 |
methodSet := classMap at: method mclass theNonMetaclass ifAbsentPut: [ Set new ]. |
183
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
94 |
methodSet add: method. |
167 | 95 |
]. |
96 |
||
97 |
packageMap keys asSortedCollection do:[:package| |
|
98 |
| classMap | |
|
99 |
||
100 |
self writePackage: package with:[ |
|
101 |
((classMap := packageMap at: package) keys asSortedCollection:[:a :b| a name < b name ]) do:[:class| |
|
183
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
102 |
| methodSet | |
167 | 103 |
self writeClass: class with:[ |
183
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
104 |
| methodSetOrdered info | |
167 | 105 |
|
183
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
106 |
info := infos at: class ifAbsentPut:[ReportSourceInfo for: class]. |
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
107 |
methodSetOrdered := (classMap at: class) asSortedCollection:[:a :b | (info offsetOfMethod: a) < (info offsetOfMethod: b)]. |
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
108 |
methodSetOrdered do:[:method| |
167 | 109 |
self writeMethod: method. |
110 |
] |
|
111 |
] |
|
112 |
] |
|
113 |
] |
|
114 |
] |
|
115 |
||
116 |
"Created: / 25-06-2013 / 13:17:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
186
b53f4cc947e1
Improvements in coverage - exclude accessors and metadata methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
183
diff
changeset
|
117 |
"Modified: / 28-06-2013 / 01:57:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
167 | 118 |
! |
119 |
||
120 |
writeClass: class with: content |
|
121 |
||
122 |
| className classFileName classPathName | |
|
123 |
||
124 |
className := class name. |
|
125 |
classFileName := class isPrivate |
|
182
556ad4c2c381
class: Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
167
diff
changeset
|
126 |
ifTrue:[(Smalltalk fileNameForClass: class topOwningClass) , '.st'] |
556ad4c2c381
class: Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
167
diff
changeset
|
127 |
ifFalse:[(Smalltalk fileNameForClass: class) , '.st']. |
167 | 128 |
class package ~~ currentPackage ifTrue:[ |
129 |
classFileName := 'extensions.st' |
|
130 |
]. |
|
131 |
classPathName := ((currentPackage copyReplaceAll: $: with: Filename separator) replaceAll: $/ with: Filename separator) |
|
132 |
, Filename separator , classFileName. |
|
133 |
||
134 |
stream nextPutAll:' <class name="'; nextPutAll: className; nextPutAll: '" filename="'; nextPutAll: classPathName; nextPutLine:'" line-rate="1.0" branch-rate="1.0" complexity="1.0">'. |
|
135 |
stream nextPutLine:' <methods>'. |
|
136 |
currentClass := class. |
|
183
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
137 |
currentClassLinesBuffer := String new writeStream. |
167 | 138 |
content value. |
139 |
currentClass := nil. |
|
140 |
stream nextPutLine:' </methods>'. |
|
183
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
141 |
stream nextPutLine:' <lines>'. |
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
142 |
stream nextPutAll: currentClassLinesBuffer contents. |
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
143 |
stream nextPutLine:' </lines>'. |
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
144 |
currentClassLinesBuffer := nil. |
167 | 145 |
stream nextPutLine:' </class>' |
146 |
||
147 |
"Created: / 25-06-2013 / 12:29:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
183
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
148 |
"Modified: / 27-06-2013 / 00:05:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
167 | 149 |
! |
150 |
||
151 |
writeFooter |
|
152 |
stream nextPutAll:' </packages> |
|
153 |
</coverage>' |
|
154 |
||
155 |
"Modified: / 25-06-2013 / 11:57:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
156 |
! |
|
157 |
||
158 |
writeHeader |
|
159 |
stream nextPutAll:'<?xml version="1.0"?> |
|
160 |
<!!--DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-03.dtd"--> |
|
161 |
||
182
556ad4c2c381
class: Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
167
diff
changeset
|
162 |
<coverage line-rate="1.0" branch-rate="1.0" version="1.9" timestamp="'; nextPutAll: Timestamp now utcSecondsSince1970 printString; nextPutLine:'">'. |
556ad4c2c381
class: Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
167
diff
changeset
|
163 |
stream nextPutLine:' <sources>'. |
556ad4c2c381
class: Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
167
diff
changeset
|
164 |
Smalltalk packagePath do:[:each| |
556ad4c2c381
class: Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
167
diff
changeset
|
165 |
stream |
556ad4c2c381
class: Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
167
diff
changeset
|
166 |
nextPutAll: '<source>'; |
556ad4c2c381
class: Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
167
diff
changeset
|
167 |
nextPutAll: each asFilename asAbsoluteFilename pathName; |
556ad4c2c381
class: Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
167
diff
changeset
|
168 |
nextPutAll: '</source>'; |
556ad4c2c381
class: Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
167
diff
changeset
|
169 |
cr. |
556ad4c2c381
class: Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
167
diff
changeset
|
170 |
]. |
556ad4c2c381
class: Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
167
diff
changeset
|
171 |
stream nextPutLine:' </sources>'. |
556ad4c2c381
class: Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
167
diff
changeset
|
172 |
stream nextPutLine:' <packages>'. |
167 | 173 |
|
182
556ad4c2c381
class: Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
167
diff
changeset
|
174 |
"Modified: / 26-06-2013 / 17:50:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
167 | 175 |
! |
176 |
||
183
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
177 |
writeLine: lineNr hits: nhits on: s |
167 | 178 |
|
183
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
179 |
s nextPutAll:' <line number="'; nextPutAll: lineNr printString; nextPutAll:'" hits="'; nextPutAll: nhits printString; nextPutLine:'" branch="false" />'. |
167 | 180 |
|
183
4e6fc1b6c282
Fixes in Builder::CoverageReportFormat
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
182
diff
changeset
|
181 |
"Created: / 27-06-2013 / 00:03:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
167 | 182 |
! |
183 |
||
184 |
writeMethod: method |
|
185 |
||
193
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
186 |
| info firstCharOffset firstLineNr lastLineNr analyzer lines name | |
167 | 187 |
|
186
b53f4cc947e1
Improvements in coverage - exclude accessors and metadata methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
183
diff
changeset
|
188 |
name := method selector. |
b53f4cc947e1
Improvements in coverage - exclude accessors and metadata methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
183
diff
changeset
|
189 |
method mclass isMetaclass ifTrue:[ |
b53f4cc947e1
Improvements in coverage - exclude accessors and metadata methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
183
diff
changeset
|
190 |
name := name , ' [class method]'. |
b53f4cc947e1
Improvements in coverage - exclude accessors and metadata methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
183
diff
changeset
|
191 |
]. |
b53f4cc947e1
Improvements in coverage - exclude accessors and metadata methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
183
diff
changeset
|
192 |
|
b53f4cc947e1
Improvements in coverage - exclude accessors and metadata methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
183
diff
changeset
|
193 |
stream nextPutAll:' <method name="'; nextPutAll: name; nextPutLine: '" signature="" line-rate="1.0" branch-rate="1.0" complexity="1.0">'. |
167 | 194 |
stream nextPutLine:' <lines>'. |
195 |
currentMethod := method. |
|
196 |
||
186
b53f4cc947e1
Improvements in coverage - exclude accessors and metadata methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
183
diff
changeset
|
197 |
info := infos at: method mclass theNonMetaclass ifAbsentPut:[ReportSourceInfo for: method mclass theNonMetaclass]. |
167 | 198 |
firstCharOffset := info offsetOfMethod: method. |
199 |
firstLineNr := (info lineAndColumnOfOffset: firstCharOffset) x. |
|
200 |
lastLineNr := (info lineAndColumnOfOffset: firstCharOffset + method source size) x. |
|
201 |
||
192
c1bb8ec592e1
Update after changes in InstrumentingCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
202 |
lines := Array new: lastLineNr - firstLineNr + 1 withAll: nil. |
193
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
203 |
analyzer := MethodAnalyzer new. |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
204 |
analyzer parseMethod: method source in: method mclass. |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
205 |
analyzer intervals do:[:interval| |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
206 |
| start stop | |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
207 |
|
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
208 |
start := info lineAndColumnOfOffset: interval first. |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
209 |
stop := info lineAndColumnOfOffset: interval last. |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
210 |
start x to: stop x do:[:lineNr| |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
211 |
lines at: lineNr put: -1. |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
212 |
]. |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
213 |
]. |
167 | 214 |
|
192
c1bb8ec592e1
Update after changes in InstrumentingCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
215 |
(method statementInvocationInfo copy sort:[:a :b | a startPosition < b startPosition]) do:[:eachBlockInfo | |
167 | 216 |
| startLine endLine | |
217 |
||
218 |
startLine := (info lineAndColumnOfOffset: firstCharOffset + eachBlockInfo startPosition - 1) x. |
|
219 |
endLine := (info lineAndColumnOfOffset: firstCharOffset + eachBlockInfo endPosition - 1) x. |
|
220 |
startLine to: endLine do:[:lineNr| |
|
193
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
221 |
(lines at: (lineNr - firstLineNr + 1)) == -1 ifTrue:[ |
192
c1bb8ec592e1
Update after changes in InstrumentingCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
222 |
lines at: (lineNr - firstLineNr + 1) put: (eachBlockInfo count) |
c1bb8ec592e1
Update after changes in InstrumentingCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
223 |
] ifFalse:[ |
c1bb8ec592e1
Update after changes in InstrumentingCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
224 |
lines at: (lineNr - firstLineNr + 1) put: ((lines at: (lineNr - firstLineNr + 1)) min: eachBlockInfo count) |
c1bb8ec592e1
Update after changes in InstrumentingCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
225 |
] |
167 | 226 |
] |
227 |
]. |
|
228 |
1 to: lines size do:[:i| |
|
193
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
229 |
(lines at: i) notNil ifTrue:[ |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
230 |
(lines at: i) == -1 ifTrue:[ |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
231 |
lines at: i put: 0. |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
232 |
]. |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
233 |
self writeLine: (i + firstLineNr - 1) hits: ((lines at: i)) on: stream. |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
234 |
self writeLine: (i + firstLineNr - 1) hits: ((lines at: i)) on: currentClassLinesBuffer. |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
235 |
] |
167 | 236 |
]. |
237 |
||
238 |
currentMethod := nil. |
|
239 |
stream nextPutLine:' </lines>'. |
|
240 |
stream nextPutLine:' </method>' |
|
241 |
||
242 |
"Created: / 25-06-2013 / 13:17:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
193
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
243 |
"Modified: / 29-07-2013 / 10:56:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
167 | 244 |
! |
245 |
||
246 |
writePackage: packageName with: aBlock |
|
247 |
||
248 |
stream nextPutAll:' <package name="'; nextPutAll: packageName; nextPutLine: '" line-rate="1.0" branch-rate="1.0" complexity="1.0">'. |
|
249 |
stream nextPutLine:' <classes>'. |
|
250 |
currentPackage := packageName. |
|
251 |
aBlock value. |
|
252 |
currentPackage := nil. |
|
253 |
stream nextPutLine:' </classes>'. |
|
254 |
stream nextPutLine:' </package>' |
|
255 |
||
256 |
"Created: / 25-06-2013 / 11:55:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
257 |
"Modified: / 25-06-2013 / 13:24:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
258 |
! ! |
|
259 |
||
193
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
260 |
!CoverageReportFormat::Cobertura::MethodAnalyzer methodsFor:'accessing'! |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
261 |
|
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
262 |
branches |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
263 |
^ branches |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
264 |
! |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
265 |
|
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
266 |
intervals |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
267 |
^ intervals |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
268 |
! ! |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
269 |
|
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
270 |
!CoverageReportFormat::Cobertura::MethodAnalyzer methodsFor:'code generation hooks'! |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
271 |
|
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
272 |
statementListRewriteHookFor:aStatementNode |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
273 |
"invoked whenever a statement list node has been generated; |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
274 |
gives subclasses a chance to rewrite (instrument) it" |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
275 |
|
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
276 |
| stmt | |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
277 |
|
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
278 |
intervals isNil ifTrue:[ |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
279 |
intervals := OrderedCollection new. |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
280 |
]. |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
281 |
stmt := aStatementNode. |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
282 |
[ stmt notNil ] whileTrue:[ |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
283 |
intervals add: (stmt startPosition to: stmt endPosition). |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
284 |
stmt := stmt nextStatement. |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
285 |
]. |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
286 |
^ aStatementNode |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
287 |
|
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
288 |
"Created: / 29-07-2013 / 10:16:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
289 |
"Modified: / 29-07-2013 / 11:25:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
290 |
! ! |
9171e507b523
Report only lines which contains real code (ignoring comments, method signature and so on)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
192
diff
changeset
|
291 |
|
167 | 292 |
!CoverageReportFormat class methodsFor:'documentation'! |
293 |
||
294 |
version |
|
295 |
^ '$Header$' |
|
296 |
! |
|
297 |
||
298 |
version_CVS |
|
299 |
^ '$Header$' |
|
300 |
! ! |
|
301 |