@@ -68,10 +68,11 @@ public string Report(CoverageResult result)
6868
6969 var methLineCoverage = summary . CalculateLineCoverage ( meth . Value . Lines ) ;
7070 var methBranchCoverage = summary . CalculateBranchCoverage ( meth . Value . Branches ) ;
71+ var methCyclomaticComplexity = summary . CalculateCyclomaticComplexity ( meth . Value . Branches ) ;
7172
7273 XElement method = new XElement ( "Method" ) ;
7374
74- method . Add ( new XAttribute ( "cyclomaticComplexity" , "0" ) ) ;
75+ method . Add ( new XAttribute ( "cyclomaticComplexity" , methCyclomaticComplexity . ToString ( ) ) ) ;
7576 method . Add ( new XAttribute ( "nPathComplexity" , "0" ) ) ;
7677 method . Add ( new XAttribute ( "sequenceCoverage" , methLineCoverage . Percent . ToString ( ) ) ) ;
7778 method . Add ( new XAttribute ( "branchCoverage" , methBranchCoverage . Percent . ToString ( ) ) ) ;
@@ -156,8 +157,8 @@ public string Report(CoverageResult result)
156157 methodSummary . Add ( new XAttribute ( "visitedBranchPoints" , methBranchCoverage . Covered . ToString ( ) ) ) ;
157158 methodSummary . Add ( new XAttribute ( "sequenceCoverage" , methLineCoverage . Percent . ToString ( ) ) ) ;
158159 methodSummary . Add ( new XAttribute ( "branchCoverage" , methBranchCoverage . Percent . ToString ( ) ) ) ;
159- methodSummary . Add ( new XAttribute ( "maxCyclomaticComplexity" , "0" ) ) ;
160- methodSummary . Add ( new XAttribute ( "minCyclomaticComplexity" , "0" ) ) ;
160+ methodSummary . Add ( new XAttribute ( "maxCyclomaticComplexity" , methCyclomaticComplexity . ToString ( ) ) ) ;
161+ methodSummary . Add ( new XAttribute ( "minCyclomaticComplexity" , methCyclomaticComplexity . ToString ( ) ) ) ;
161162 methodSummary . Add ( new XAttribute ( "visitedClasses" , "0" ) ) ;
162163 methodSummary . Add ( new XAttribute ( "numClasses" , "0" ) ) ;
163164 methodSummary . Add ( new XAttribute ( "visitedMethods" , methodVisited ? "1" : "0" ) ) ;
@@ -181,15 +182,17 @@ public string Report(CoverageResult result)
181182 var classLineCoverage = summary . CalculateLineCoverage ( cls . Value ) ;
182183 var classBranchCoverage = summary . CalculateBranchCoverage ( cls . Value ) ;
183184 var classMethodCoverage = summary . CalculateMethodCoverage ( cls . Value ) ;
185+ var classMaxCyclomaticComplexity = summary . CalculateMaxCyclomaticComplexity ( cls . Value ) ;
186+ var classMinCyclomaticComplexity = summary . CalculateMinCyclomaticComplexity ( cls . Value ) ;
184187
185188 classSummary . Add ( new XAttribute ( "numSequencePoints" , classLineCoverage . Total . ToString ( ) ) ) ;
186189 classSummary . Add ( new XAttribute ( "visitedSequencePoints" , classLineCoverage . Covered . ToString ( ) ) ) ;
187190 classSummary . Add ( new XAttribute ( "numBranchPoints" , classBranchCoverage . Total . ToString ( ) ) ) ;
188191 classSummary . Add ( new XAttribute ( "visitedBranchPoints" , classBranchCoverage . Covered . ToString ( ) ) ) ;
189192 classSummary . Add ( new XAttribute ( "sequenceCoverage" , classLineCoverage . Percent . ToString ( ) ) ) ;
190193 classSummary . Add ( new XAttribute ( "branchCoverage" , classBranchCoverage . Percent . ToString ( ) ) ) ;
191- classSummary . Add ( new XAttribute ( "maxCyclomaticComplexity" , "0" ) ) ;
192- classSummary . Add ( new XAttribute ( "minCyclomaticComplexity" , "0" ) ) ;
194+ classSummary . Add ( new XAttribute ( "maxCyclomaticComplexity" , classMaxCyclomaticComplexity . ToString ( ) ) ) ;
195+ classSummary . Add ( new XAttribute ( "minCyclomaticComplexity" , classMinCyclomaticComplexity . ToString ( ) ) ) ;
193196 classSummary . Add ( new XAttribute ( "visitedClasses" , classVisited ? "1" : "0" ) ) ;
194197 classSummary . Add ( new XAttribute ( "numClasses" , "1" ) ) ;
195198 classSummary . Add ( new XAttribute ( "visitedMethods" , classMethodCoverage . Covered . ToString ( ) ) ) ;
@@ -210,15 +213,17 @@ public string Report(CoverageResult result)
210213
211214 var moduleLineCoverage = summary . CalculateLineCoverage ( result . Modules ) ;
212215 var moduleBranchCoverage = summary . CalculateLineCoverage ( result . Modules ) ;
216+ var moduleMaxCyclomaticComplexity = summary . CalculateMaxCyclomaticComplexity ( result . Modules ) ;
217+ var moduleMinCyclomaticComplexity = summary . CalculateMinCyclomaticComplexity ( result . Modules ) ;
213218
214219 coverageSummary . Add ( new XAttribute ( "numSequencePoints" , moduleLineCoverage . Total . ToString ( ) ) ) ;
215220 coverageSummary . Add ( new XAttribute ( "visitedSequencePoints" , moduleLineCoverage . Covered . ToString ( ) ) ) ;
216221 coverageSummary . Add ( new XAttribute ( "numBranchPoints" , moduleBranchCoverage . Total . ToString ( ) ) ) ;
217222 coverageSummary . Add ( new XAttribute ( "visitedBranchPoints" , moduleBranchCoverage . Covered . ToString ( ) ) ) ;
218223 coverageSummary . Add ( new XAttribute ( "sequenceCoverage" , moduleLineCoverage . Percent . ToString ( ) ) ) ;
219224 coverageSummary . Add ( new XAttribute ( "branchCoverage" , moduleBranchCoverage . Percent . ToString ( ) ) ) ;
220- coverageSummary . Add ( new XAttribute ( "maxCyclomaticComplexity" , "0" ) ) ;
221- coverageSummary . Add ( new XAttribute ( "minCyclomaticComplexity" , "0" ) ) ;
225+ coverageSummary . Add ( new XAttribute ( "maxCyclomaticComplexity" , moduleMaxCyclomaticComplexity . ToString ( ) ) ) ;
226+ coverageSummary . Add ( new XAttribute ( "minCyclomaticComplexity" , moduleMinCyclomaticComplexity . ToString ( ) ) ) ;
222227 coverageSummary . Add ( new XAttribute ( "visitedClasses" , visitedClasses . ToString ( ) ) ) ;
223228 coverageSummary . Add ( new XAttribute ( "numClasses" , numClasses . ToString ( ) ) ) ;
224229 coverageSummary . Add ( new XAttribute ( "visitedMethods" , visitedMethods . ToString ( ) ) ) ;
0 commit comments