@@ -44,7 +44,9 @@ Property LineIsPython As array Of %Boolean;
44
44
/// Set to true if this class/routine is generated
45
45
Property Generated As %Boolean [ InitialExpression = 0 ];
46
46
47
- ///
47
+ /// If the CodeUnit has changed since we last updated it, used to see if we need to call UpdateComplexity
48
+ Property OutdatedComplexity As %Boolean [ InitialExpression = 1 ];
49
+
48
50
/// Methods, branches, etc. within this unit of code.
49
51
Relationship SubUnits As TestCoverage .Data .CodeSubUnit [ Cardinality = children , Inverse = Parent ];
50
52
@@ -87,6 +89,9 @@ ClassMethod GetCurrentByName(pInternalName As %String, pSourceNamespace As %Stri
87
89
If (tUpdatedHash '= tKnownHash ) {
88
90
//Clear out old data and flag the need for an update.
89
91
Set tNeedsUpdate = 1
92
+ If $IsObject ($Get (tMapToUnit )) {
93
+ set tMapToUnit .OutdatedComplexity = 1
94
+ }
90
95
&sql (delete from TestCoverage_Data .CodeUnitMap where ToHash = :tKnownHash)
91
96
If (SQLCODE < 0 ) {
92
97
Throw ##class (%Exception.SQL ).CreateFromSQLCODE (SQLCODE ,%msg )
@@ -521,9 +526,10 @@ Method UpdateSourceMap(pSourceNamespace As %String, ByRef pCache) As %Status
521
526
}
522
527
}
523
528
524
- // Update cyclomatic complexity for methods in the linked class
529
+ // Update cyclomatic complexity for methods in the linked class if we don't already have the newest version
525
530
Set tClass = $Order (tCodeUnits (" CLS" ," " ),1 ,tClassCodeUnit )
526
- If $IsObject ($Get (tClassCodeUnit )) {
531
+ If ($IsObject ($Get (tClassCodeUnit )) && (tClassCodeUnit .OutdatedComplexity )){
532
+ set tClassCodeUnit .OutdatedComplexity = 0
527
533
$$$ThrowOnError(tClassCodeUnit .UpdateComplexity ())
528
534
}
529
535
} Catch e {
@@ -690,6 +696,9 @@ Storage Default
690
696
<Value name =" 5" >
691
697
<Value >Generated </Value >
692
698
</Value >
699
+ <Value name =" 6" >
700
+ <Value >OutdatedComplexity </Value >
701
+ </Value >
693
702
</Data >
694
703
<Data name =" LineIsPython" >
695
704
<Attribute >LineIsPython </Attribute >
0 commit comments