From e08802e2165b1f148d6d69643c8dd19d7020f889 Mon Sep 17 00:00:00 2001
From: Dima Brusilovsky <dimabru@gmail.com>
Date: Wed, 28 Apr 2021 16:46:04 +0300
Subject: [PATCH] fix: total failed count

---
 bl/evaluator.go | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/bl/evaluator.go b/bl/evaluator.go
index 6c8724d..c32a3ca 100644
--- a/bl/evaluator.go
+++ b/bl/evaluator.go
@@ -148,12 +148,8 @@ func (e *Evaluator) aggregateEvaluationResults(evaluationResults []cliClient.Eva
 
 	totalRulesCount := len(evaluationResults)
 	totalFailedCount := 0
-	filenames := make(map[string]string)
 
 	for _, result := range evaluationResults {
-		if !result.Passed {
-			totalFailedCount++
-		}
 		for _, match := range result.Results.Matches {
 			// file not already exists in mapper
 			if _, exists := mapper[match.FileName]; !exists {
@@ -162,17 +158,12 @@ func (e *Evaluator) aggregateEvaluationResults(evaluationResults []cliClient.Eva
 
 			// file and rule not already exists in mapper
 			if _, exists := mapper[match.FileName][result.Rule.ID]; !exists {
-				filenames[match.FileName] = match.FileName
+				totalFailedCount++
 				mapper[match.FileName][result.Rule.ID] = &Rule{ID: result.Rule.ID, Name: result.Rule.Name, FailSuggestion: result.Rule.FailSuggestion, Count: 0}
 			}
 
 			mapper[match.FileName][result.Rule.ID].IncrementCount()
 		}
-		for _, mismatch := range result.Results.Mismatches {
-			if _, exists := mapper[mismatch.FileName]; !exists {
-				filenames[mismatch.FileName] = mismatch.FileName
-			}
-		}
 	}
 
 	results := &EvaluationResults{
-- 
GitLab