File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -403,6 +403,11 @@ func (su *ScoreUtil) GetFrameworkComplianceScore(framework *reportsummary.Framew
403403
404404// GetControlComplianceScore returns the compliance score for a given control (as a percentage).
405405func (su * ScoreUtil ) GetControlComplianceScore (ctrl reportsummary.IControlSummary , _ /*frameworkName*/ string ) float32 {
406+ // If a control has status passed it should always be considered as having 100% compliance score
407+ if ctrl .GetStatus ().IsPassed () {
408+ return 100
409+ }
410+
406411 resourcesIDs := ctrl .ListResourcesIDs ()
407412 passedResourceIDS := resourcesIDs .Passed ()
408413 allResourcesIDSIter := resourcesIDs .All ()
@@ -426,11 +431,5 @@ func (su *ScoreUtil) GetControlComplianceScore(ctrl reportsummary.IControlSummar
426431 if numOfAllResources > 0 {
427432 return (numOfPassedResources / numOfAllResources ) * 100
428433 }
429-
430- // in case the control didn't run on any resources:
431- // If the control passed (irrelevant): score = 100 , else (skipped): score = 0
432- if ctrl .GetStatus ().IsPassed () {
433- return 100
434- }
435434 return 0
436435}
You can’t perform that action at this time.
0 commit comments