From af18f783f53e6bd3b1e3a40437eaf9a2ffc5a937 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Sun, 5 Jan 2025 03:47:01 +0100 Subject: [PATCH] handle empty case in some metric tests --- .../instance/averageHierarchyHeightOf..st | 5 +++-- .../instance/averageNumberOfDerivedClassesOf..st | 6 +++--- .../SLCodingStylesPlugIn.class/instance/systemCALLS..st | 2 +- .../SLCodingStylesPlugIn.class/instance/systemCYCLO..st | 2 +- .../SLCodingStylesPlugIn.class/methodProperties.json | 8 ++++---- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/instance/averageHierarchyHeightOf..st b/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/instance/averageHierarchyHeightOf..st index 7770c049..a164c6ce 100644 --- a/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/instance/averageHierarchyHeightOf..st +++ b/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/instance/averageHierarchyHeightOf..st @@ -1,5 +1,6 @@ private averageHierarchyHeightOf: aSLSystemTestObject - ^ ((aSLSystemTestObject rootClasses collect: - [:class | class resultOf: #heightOfInheritanceTree: ]) sum) / (aSLSystemTestObject rootClasses size) \ No newline at end of file + ^ (((aSLSystemTestObject rootClasses ifEmpty: [^ Float nan]) + collect: [:class | class resultOf: #heightOfInheritanceTree:]) sum) + / aSLSystemTestObject rootClasses size \ No newline at end of file diff --git a/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/instance/averageNumberOfDerivedClassesOf..st b/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/instance/averageNumberOfDerivedClassesOf..st index faf07307..7c6a2254 100644 --- a/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/instance/averageNumberOfDerivedClassesOf..st +++ b/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/instance/averageNumberOfDerivedClassesOf..st @@ -1,6 +1,6 @@ private averageNumberOfDerivedClassesOf: aSLSystemTestObject - - ^ ((aSLSystemTestObject allClasses collect: - [:class | class testObject subclasses size]) sum ) / (aSLSystemTestObject resultOf: #classCount:) \ No newline at end of file + ^ ((aSLSystemTestObject allClasses ifEmpty: [^ Float nan]) + collect: [:class | class testObject subclasses size]) sum + / (aSLSystemTestObject resultOf: #classCount:) \ No newline at end of file diff --git a/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/instance/systemCALLS..st b/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/instance/systemCALLS..st index ba6334e6..bde91837 100644 --- a/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/instance/systemCALLS..st +++ b/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/instance/systemCALLS..st @@ -1,7 +1,7 @@ private systemCALLS: aSLSystemTestObject - ^((aSLSystemTestObject allClasses collect: + ^(((aSLSystemTestObject allClasses ifEmpty: [^ Float nan]) collect: [:class | (class methods ifEmpty: [{0}] ifNotEmpty: [(class methods collect: [:method | (method resultOf: #methodCallers:) itemCount])]) sum ]) diff --git a/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/instance/systemCYCLO..st b/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/instance/systemCYCLO..st index 52faa2bf..886e97c0 100644 --- a/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/instance/systemCYCLO..st +++ b/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/instance/systemCYCLO..st @@ -1,7 +1,7 @@ private systemCYCLO: aSLSystemTestObject - ^((aSLSystemTestObject allClasses collect: + ^(((aSLSystemTestObject allClasses ifEmpty: [^ Float nan]) collect: [:class | (class methods ifEmpty: [{0}] ifNotEmpty: [(class methods collect: [:method | (method resultOf: #methodCYCLO:) result])]) sum ]) diff --git a/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/methodProperties.json b/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/methodProperties.json index 678becbb..64a73395 100644 --- a/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/methodProperties.json +++ b/packages/SwaLint-PlugIns.package/SLCodingStylesPlugIn.class/methodProperties.json @@ -5,9 +5,9 @@ "defaultCategory" : "AT 5/7/2008 21:30" }, "instance" : { "averageHierarchyHeight:" : "ct 12/19/2024 20:25", - "averageHierarchyHeightOf:" : "ct 12/19/2024 20:25", + "averageHierarchyHeightOf:" : "ct 1/5/2025 03:43", "averageNumberOfDerivedClasses:" : "NA 7/31/2015 19:27", - "averageNumberOfDerivedClassesOf:" : "NA 7/30/2015 12:32", + "averageNumberOfDerivedClassesOf:" : "ct 1/5/2025 03:44", "classNamespaceResult:" : "BD 6/29/2018 12:47", "collectNamespaces:" : "AT 5/27/2008 18:14", "commonStartOf:" : "BD 6/29/2018 12:16", @@ -34,6 +34,6 @@ "overviewPyramidMetric:" : "ct 12/20/2024 01:17", "printOn:" : "NH 6/24/2015 14:11", "qualityResult:" : "BD 7/4/2018 19:45", - "systemCALLS:" : "SH 6/18/2015 11:54", - "systemCYCLO:" : "SH 6/18/2015 11:49", + "systemCALLS:" : "ct 1/5/2025 03:44", + "systemCYCLO:" : "ct 1/5/2025 03:45", "systemFANOUT:" : "BD 7/25/2018 16:17" } }