Skip to content

Commit

Permalink
#453 fix ccm metrics calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
HDouss committed Apr 20, 2020
1 parent 14744f6 commit f4fc5d7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
6 changes: 0 additions & 6 deletions src/main/java/org/jpeek/skeleton/XmlClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@
*
* @see <a href="http://www.pitt.edu/~ckemerer/CK%20research%20papers/MetricForOOD_ChidamberKemerer94.pdf">A packages suite for object oriented design</a>
* @since 0.27
* @todo #447:30min This class includes the constructor as part of the methods
* it considers, so it breaks some of the metrics. For example the CCM metrics
* test on OverloadMethods (see metricstest-params.csv) expects 0.6 as a result
* while it should be 1. See #447 for details on that. Find out if the constructor
* should be counted as one of the methods or not (does it depend on the metrics
* for example?) and fix it this class and the tests if needed.
* @checkstyle AbbreviationAsWordInNameCheck (5 lines)
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
* @checkstyle ParameterNumberCheck (500 lines)
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/org/jpeek/metrics/CCM.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ SOFTWARE.
</metric>
</xsl:template>
<xsl:template match="class">
<xsl:variable name="methods" select="methods/method"/>
<xsl:variable name="methods" select="methods/method[@ctor='false']"/>
<xsl:variable name="edges">
<xsl:for-each select="$methods">
<xsl:variable name="method" select="."/>
Expand Down
10 changes: 5 additions & 5 deletions src/test/resources/org/jpeek/metricstest-params.csv
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TwoCommonAttributes,NHD,0.3333d
OneVoidMethodWithoutParams,NHD,NaN
WithoutAttributes,NHD,0.0d
OneMethodCreatesLambda,NHD,0.0d
MethodsWithDiffParamTypes,CCM,0.0476d
MethodsWithDiffParamTypes,CCM,0.0667d
Foo,SCOM,0.5d
MethodsWithDiffParamTypes,SCOM,0.2381d
OverloadMethods,SCOM,0.75d
Expand Down Expand Up @@ -113,11 +113,11 @@ NoMethods,CCM,NaN
WithoutAttributes,CCM,NaN
OneMethodCreatesLambda,CCM,NaN
OneVoidMethodWithoutParams,CCM,NaN
Bar,CCM,0.125d
Foo,CCM,0.1667d
OverloadMethods,CCM,0.6d
Bar,CCM,0.2222d
Foo,CCM,0.5d
OverloadMethods,CCM,1.0d
TwoCommonAttributes,CCM,NaN
TwoCommonMethods,CCM,0.0238d
TwoCommonMethods,CCM,0.0333d
Bar,MWE,1.0d
Foo,MWE,1.0d
MethodMethodCalls,MWE,1.0d
Expand Down

0 comments on commit f4fc5d7

Please sign in to comment.