Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [4.0.1] - 2024-08-09

### Fixed
- #45: Fixed Python line 0 tracking for 2024.2
- #46: Fix for bug caused by UpdateComplexity calling GetCurrentByName unnecessarily and causing dependency issues

## [4.0.0] - 2024-08-01

Expand Down
15 changes: 12 additions & 3 deletions cls/TestCoverage/Data/CodeUnit.cls
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ Property LineIsPython As array Of %Boolean;
/// Set to true if this class/routine is generated
Property Generated As %Boolean [ InitialExpression = 0 ];

///
/// If the CodeUnit has changed since we last updated it, used to see if we need to call UpdateComplexity
Property OutdatedComplexity As %Boolean [ InitialExpression = 1 ];

/// Methods, branches, etc. within this unit of code.
Relationship SubUnits As TestCoverage.Data.CodeSubUnit [ Cardinality = children, Inverse = Parent ];

Expand Down Expand Up @@ -87,6 +89,9 @@ ClassMethod GetCurrentByName(pInternalName As %String, pSourceNamespace As %Stri
If (tUpdatedHash '= tKnownHash) {
//Clear out old data and flag the need for an update.
Set tNeedsUpdate = 1
If $IsObject($Get(tMapToUnit)) {
set tMapToUnit.OutdatedComplexity = 1
}
&sql(delete from TestCoverage_Data.CodeUnitMap where ToHash = :tKnownHash)
If (SQLCODE < 0) {
Throw ##class(%Exception.SQL).CreateFromSQLCODE(SQLCODE,%msg)
Expand Down Expand Up @@ -521,9 +526,10 @@ Method UpdateSourceMap(pSourceNamespace As %String, ByRef pCache) As %Status
}
}

// Update cyclomatic complexity for methods in the linked class
// Update cyclomatic complexity for methods in the linked class if we don't already have the newest version
Set tClass = $Order(tCodeUnits("CLS",""),1,tClassCodeUnit)
If $IsObject($Get(tClassCodeUnit)) {
If ($IsObject($Get(tClassCodeUnit)) && (tClassCodeUnit.OutdatedComplexity)){
set tClassCodeUnit.OutdatedComplexity = 0
$$$ThrowOnError(tClassCodeUnit.UpdateComplexity())
}
} Catch e {
Expand Down Expand Up @@ -690,6 +696,9 @@ Storage Default
<Value name="5">
<Value>Generated</Value>
</Value>
<Value name="6">
<Value>OutdatedComplexity</Value>
</Value>
</Data>
<Data name="LineIsPython">
<Attribute>LineIsPython</Attribute>
Expand Down
9 changes: 4 additions & 5 deletions cls/TestCoverage/Manager.cls
Original file line number Diff line number Diff line change
Expand Up @@ -683,12 +683,11 @@ ClassMethod OnBeforeAllTests(manager As TestCoverage.Manager, dir As %String, By
Set tSC = manager.UpdateCoverageTargetsForTestDirectory(dir)
$$$ThrowOnError(tSC)
}

if (manager.ListenerManager) {
set tObj = {"message": "Starting tests"}
Do manager.ListenerManager.BroadCastToAll(tObj)
}
If (manager.CoverageDetail = 0) {
if (manager.ListenerManager) {
set tObj = {"message": "Starting tests"}
Do manager.ListenerManager.BroadCastToAll(tObj)
}
Set tSC = manager.StartCoverageTracking()
$$$ThrowOnError(tSC)
}
Expand Down
Loading