From f8fd42e8fb734584807a53d342df59ce8af4b81e Mon Sep 17 00:00:00 2001 From: Chris Ge Date: Tue, 13 Aug 2024 16:37:33 -0400 Subject: [PATCH] fix: UpdateComplexity and one of the calls in GetCurrentByName no longer use GetCurrentByName just for getting the hash and code of a CodeUnit --- cls/TestCoverage/Data/CodeUnit.cls | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cls/TestCoverage/Data/CodeUnit.cls b/cls/TestCoverage/Data/CodeUnit.cls index 0ac96c3..09781d7 100644 --- a/cls/TestCoverage/Data/CodeUnit.cls +++ b/cls/TestCoverage/Data/CodeUnit.cls @@ -82,9 +82,9 @@ ClassMethod GetCurrentByName(pInternalName As %String, pSourceNamespace As %Stri $$$ThrowOnError(tSC) Set tKnownHash = tMapToResult.%GetData(1) Set tMapToUnit = ..HashOpen(tKnownHash,,.tSC) - $$$ThrowOnError(tSC) - $$$ThrowOnError(..GetCurrentByName(tMapToUnit.Name_"."_tMapToUnit.Type,pSourceNamespace,.tUpdatedUnit,.pCache)) - If (tUpdatedUnit.Hash '= tKnownHash) { + $$$ThrowOnError(tSC) + do ..GetCurrentHash(tMapToUnit.Name, tMapToUnit.Type, .tUpdatedHash, , ) + If (tUpdatedHash '= tKnownHash) { //Clear out old data and flag the need for an update. Set tNeedsUpdate = 1 &sql(delete from TestCoverage_Data.CodeUnitMap where ToHash = :tKnownHash) @@ -247,7 +247,6 @@ ClassMethod GetCurrentByName(pInternalName As %String, pSourceNamespace As %Stri /// Fill in the LineIsPython property of .cls files Method UpdatePythonLines(pName As %String, ByRef pPyCodeUnit) As %Status { - Set tSC = $$$OK Set tOriginalNamespace = $Namespace Set tInitTLevel = $TLevel @@ -543,8 +542,9 @@ Method UpdateComplexity() As %Status // python methods If (##class(TestCoverage.Manager).HasPython(..Name)) { - do ##class(TestCoverage.Data.CodeUnit).GetCurrentByName(..Name _ ".PY", , .pPyCodeUnit, ) // need the source code for the python - set tDocumentText = pPyCodeUnit.Lines.Serialize() + do ..GetCurrentHash(..Name, "PY", ,.tPyCodeArray, ) // need the source code for the python to pass into the method complexity calculator + do ##class(TestCoverage.Utils).CodeArrayToList(.tPyCodeArray, .tDocumentText) + set tDocumentText = tDocumentText _ $listbuild("") set tMethodComplexities = ..GetPythonComplexities(tDocumentText) }