nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: Azure/WALinuxAgent
Pull request #350 (2016-08-05 22:52:25)

correct logic for dd fallback
when fallocate fails for any reason we should fall back to dd, not just when fallocate is not found. also adds unit test. fix for #347 

msftclas: Hi __@hglkrijger__, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
    <p>
        It looks like you're a Microsoft contributor (Hans Krijger). If you're full-time, we DON'T require a Contribution License Agreement. If you are a vendor, please DO sign the electronic Contribution License Agreement. It will take 2 minutes and there's no faxing! https://cla.microsoft.com.
    </p>

TTYL, MSBOT;


Patch:
diff --git a/azurelinuxagent/daemon/resourcedisk/default.py b/azurelinuxagent/daemon/resourcedisk/default.py
index f08c84ef..b900b064 100644
--- a/azurelinuxagent/daemon/resourcedisk/default.py
+++ b/azurelinuxagent/daemon/resourcedisk/default.py
@@ -201,7 +201,7 @@ class ResourceDiskHandler(object):
         # fallocate command
         fn_sh = shellutil.quote((filename,))
         ret = shellutil.run(u"umask 0077 && fallocate -l {0} {1}".format(nbytes, fn_sh))
-        if ret != 127:  # 127 = command not found
+        if ret == 0:
             return ret
 
         # dd fallback


Test patch:
diff --git a/tests/distro/test_resourceDisk.py b/tests/distro/test_resourceDisk.py
index 198fd49d..30998695 100644
--- a/tests/distro/test_resourceDisk.py
+++ b/tests/distro/test_resourceDisk.py
@@ -18,8 +18,10 @@
 # http://msdn.microsoft.com/en-us/library/cc227282%28PROT.10%29.aspx
 # http://msdn.microsoft.com/en-us/library/cc227259%28PROT.13%29.aspx
 
-from tests.tools import *
+from azurelinuxagent.common.utils import shellutil
 from azurelinuxagent.daemon.resourcedisk import get_resourcedisk_handler
+from tests.tools import *
+
 
 class TestResourceDisk(AgentTestCase):
     def test_mkfile(self):
@@ -38,5 +40,26 @@ class TestResourceDisk(AgentTestCase):
         # cleanup
         os.remove(test_file)
 
+    def test_mkfile_dd_fallback(self):
+        with patch.object(shellutil, "run") as run_patch:
+            # setup
+            run_patch.return_value = 1
+            test_file = os.path.join(self.tmp_dir, 'test_file')
+            file_size = 1024 * 128
+
+            # execute
+            if sys.version_info >= (3,3):
+                with patch("os.posix_fallocate",
+                           side_effect=Exception('failure')):
+                    get_resourcedisk_handler().mkfile(test_file, file_size)
+            else:
+                get_resourcedisk_handler().mkfile(test_file, file_size)
+
+            # assert
+            assert run_patch.call_count > 1
+            assert "fallocate" in run_patch.call_args_list[0][0][0]
+            assert "dd if" in run_patch.call_args_list[-1][0][0]
+
+
 if __name__ == '__main__':
     unittest.main()
Repository: prometheus/statsd_exporter
Pull request #211 (2019-05-13 18:59:07)

Add support for Datadog distribution type
This adds the ability to accept Datadog's distribution type and treat it like a histogram/summary.


Patch:
diff --git a/README.md b/README.md
index 46dfe95..cb8dc48 100644
--- a/README.md
+++ b/README.md
@@ -224,6 +224,8 @@ mappings:
     job: "${1}_server"
 ```
 
+Note that timers will be accepted with the `ms`, `h`, and `d` statsd types.  The first two are timers and histograms and the `d` type is for DataDog's "distribution" type.  The distribution type is treated identically to timers and histograms.
+
 ### Regular expression matching
 
 Another capability when using YAML configuration is the ability to define matches
diff --git a/exporter.go b/exporter.go
index d62a4bb..829ab33 100644
--- a/exporter.go
+++ b/exporter.go
@@ -571,7 +571,7 @@ func buildEvent(statType, metric string, value float64, relative bool, labels ma
 			relative:   relative,
 			labels:     labels,
 		}, nil
-	case "ms", "h":
+	case "ms", "h", "d":
 		return &TimerEvent{
 			metricName: metric,
 			value:      float64(value),


Test patch:
diff --git a/bridge_test.go b/bridge_test.go
index 33d4716..688d7bd 100644
--- a/bridge_test.go
+++ b/bridge_test.go
@@ -67,6 +67,26 @@ func TestHandlePacket(t *testing.T) {
 					labels:     map[string]string{},
 				},
 			},
+		}, {
+			name: "simple histogram",
+			in:   "foo:200|h",
+			out: Events{
+				&TimerEvent{
+					metricName: "foo",
+					value:      200,
+					labels:     map[string]string{},
+				},
+			},
+		}, {
+			name: "simple distribution",
+			in:   "foo:200|d",
+			out: Events{
+				&TimerEvent{
+					metricName: "foo",
+					value:      200,
+					labels:     map[string]string{},
+				},
+			},
 		}, {
 			name: "datadog tag extension",
 			in:   "foo:100|c|#tag1:bar,tag2:baz",
Repository: prometheus/statsd_exporter
Pull request #216 (2019-05-15 13:04:11)

Check for histogram conflict on main name
While it doesn't report it as a metric, when collecting, the registry considers the base metric name to belong to the histogram that's registered.  This means that we need to prevent other metrics from
registering anything under this name, in addition to checking for the `_bucket`, `_sum` and `_count` suffixes.

This was missed in #213 


Patch:
diff --git a/exporter.go b/exporter.go
index 220198d..bf2b4bd 100644
--- a/exporter.go
+++ b/exporter.go
@@ -262,6 +262,9 @@ func (c *HistogramContainer) Get(metricName string, labels prometheus.Labels, mc
 
 	histogramVec, ok := c.Elements[mapKey]
 	if !ok {
+		if mc.metricConflicts(metricName, HistogramMetricType) {
+			return nil, fmt.Errorf("metric with name %s is already registered", metricName)
+		}
 		if mc.metricConflicts(metricName+"_sum", HistogramMetricType) {
 			return nil, fmt.Errorf("metric with name %s is already registered", metricName)
 		}


Test patch:
diff --git a/exporter_test.go b/exporter_test.go
index 9abfa27..06089bd 100644
--- a/exporter_test.go
+++ b/exporter_test.go
@@ -235,6 +235,20 @@ func TestConflictingMetrics(t *testing.T) {
 				},
 			},
 		},
+		{
+			name:     "counter vs histogram",
+			expected: []float64{1},
+			in: Events{
+				&CounterEvent{
+					metricName: "histogram_test1",
+					value:      1,
+				},
+				&TimerEvent{
+					metricName: "histogram.test1",
+					value:      2,
+				},
+			},
+		},
 		{
 			name:     "counter vs histogram sum",
 			expected: []float64{1},
Repository: prometheus/statsd_exporter
Pull request #381 (2021-06-17 16:21:34)

allow multiple dashes in StatsD metric names
See https://github.com/prometheus/statsd_exporter/issues/380

@matthiasr I don't do any Go development so not sure if there's anything else to consider here 😅 

Thanks!

matthiasr: There is a test that specifically said "double dashes are illegal" – it is intended to exercise _a_ case that doesn't match this regex. Could you change it to use some other illegal character?
matthiasr: Also, please add the DCO sign-off, instructions are behind the Details link
SuperQ: It might also be useful to add a positive test like this: (line 1467)

```go
    {
      testName: "Config with multipel dashes",
      config: `mappings:
- match: "*.fabio--requests.count"
  name: "fabio_requests_count"
  help: "Fabio request count"
  labels:
    hostname: "$1"`,
      mappings: mappings{
        {
          statsdMetric: "test.fabio--requests.count",
          name:         "fabio_requests_count",
          labels: map[string]string{
            "hostname": "test",
          },
        },
      },
    },              },
```

Patch:
diff --git a/pkg/mapper/mapper.go b/pkg/mapper/mapper.go
index 12340d9..64be2e2 100644
--- a/pkg/mapper/mapper.go
+++ b/pkg/mapper/mapper.go
@@ -30,10 +30,10 @@ import (
 
 var (
 	// The first segment of a match cannot start with a number
-	statsdMetricRE = `[a-zA-Z_](-?[a-zA-Z0-9_])*`
+	statsdMetricRE = `[a-zA-Z_]([a-zA-Z0-9_\-])*`
 	// The subsequent segments of a match can start with a number
 	// See https://github.com/prometheus/statsd_exporter/issues/328
-	statsdMetricSubsequentRE = `[a-zA-Z0-9_](-?[a-zA-Z0-9_])*`
+	statsdMetricSubsequentRE = `[a-zA-Z0-9_]([a-zA-Z0-9_\-])*`
 	templateReplaceRE        = `(\$\{?\d+\}?)`
 
 	metricLineRE = regexp.MustCompile(`^(\*|` + statsdMetricRE + `)(\.\*|\.` + statsdMetricSubsequentRE + `)*$`)


Test patch:
diff --git a/pkg/mapper/mapper_test.go b/pkg/mapper/mapper_test.go
index 69d30ea..033bfc3 100644
--- a/pkg/mapper/mapper_test.go
+++ b/pkg/mapper/mapper_test.go
@@ -68,7 +68,7 @@ func TestMetricMapperYAML(t *testing.T) {
 mappings:
 - match: test.dispatcher.*.*.*
   name: "dispatch_events"
-  labels: 
+  labels:
     processor: "$1"
     action: "$2"
     result: "$3"
@@ -430,12 +430,27 @@ mappings:
 			testName: "Config with bad metric line",
 			config: `---
 mappings:
-- match: bad--metric-line.*.*
+- match: bad!!metric-line.*.*
   name: "foo"
   labels: {}
   `,
 			configBad: true,
 		},
+		{
+			testName: "Config with multiple dashes in metric name",
+			config: `---
+mappings:
+- match: "foo--bar.*"
+  name: "foo_bar_${1}"
+  labels: {}
+  `,
+			mappings: mappings{
+				{
+					statsdMetric: "foo--bar.count",
+					name:         "foo_bar_count",
+				},
+			},
+		},
 		{
 			testName: "Config with dynamic metric name",
 			config: `---
Repository: prometheus/tsdb
Pull request #537 (2019-03-02 07:02:19)

Release 0.6.0
cc @codesome 


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4eb8f48..534de25 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
 ## master / unreleased
 
+## 0.6.0
+  - [CHANGE] `AllowOverlappingBlock` is now `AllowOverlappingBlocks`.
+
 ## 0.5.0
  - [FEATURE] Time-ovelapping blocks are now allowed. [#370](https://github.com/prometheus/tsdb/pull/370)
    - Disabled by default and can be enabled via `AllowOverlappingBlock` option.
diff --git a/db.go b/db.go
index 32599c5..7b03a20 100644
--- a/db.go
+++ b/db.go
@@ -45,11 +45,11 @@ import (
 // DefaultOptions used for the DB. They are sane for setups using
 // millisecond precision timestamps.
 var DefaultOptions = &Options{
-	WALSegmentSize:        wal.DefaultSegmentSize,
-	RetentionDuration:     15 * 24 * 60 * 60 * 1000, // 15 days in milliseconds
-	BlockRanges:           ExponentialBlockRanges(int64(2*time.Hour)/1e6, 3, 5),
-	NoLockfile:            false,
-	AllowOverlappingBlock: false,
+	WALSegmentSize:         wal.DefaultSegmentSize,
+	RetentionDuration:      15 * 24 * 60 * 60 * 1000, // 15 days in milliseconds
+	BlockRanges:            ExponentialBlockRanges(int64(2*time.Hour)/1e6, 3, 5),
+	NoLockfile:             false,
+	AllowOverlappingBlocks: false,
 }
 
 // Options of the DB storage.
@@ -73,9 +73,9 @@ type Options struct {
 	// NoLockfile disables creation and consideration of a lock file.
 	NoLockfile bool
 
-	// Overlapping blocks are allowed iff AllowOverlappingBlock is true.
+	// Overlapping blocks are allowed if AllowOverlappingBlocks is true.
 	// This in-turn enables vertical compaction and vertical query merge.
-	AllowOverlappingBlock bool
+	AllowOverlappingBlocks bool
 }
 
 // Appender allows appending a batch of data. It must be completed with a
@@ -553,7 +553,7 @@ func (db *DB) reload() (err error) {
 	sort.Slice(loadable, func(i, j int) bool {
 		return loadable[i].Meta().MinTime < loadable[j].Meta().MinTime
 	})
-	if !db.opts.AllowOverlappingBlock {
+	if !db.opts.AllowOverlappingBlocks {
 		if err := validateBlockSequence(loadable); err != nil {
 			return errors.Wrap(err, "invalid block sequence")
 		}


Test patch:
diff --git a/db_test.go b/db_test.go
index c910aa2..eda807f 100644
--- a/db_test.go
+++ b/db_test.go
@@ -1933,7 +1933,7 @@ func TestVerticalCompaction(t *testing.T) {
 				createBlock(t, tmpdir, series)
 			}
 			opts := *DefaultOptions
-			opts.AllowOverlappingBlock = true
+			opts.AllowOverlappingBlocks = true
 			db, err := Open(tmpdir, nil, nil, &opts)
 			testutil.Ok(t, err)
 			defer func() {
Repository: prometheus/tsdb
Pull request #604 (2019-05-16 13:18:17)

Don't crash on an unknown tombstone ref.
Fixes https://github.com/prometheus/prometheus/issues/5562

This shouldn't happen in the first place, but at least let's be resilient and not crash. It's not as if we can delete anything from an unknown series anyway.


Patch:
diff --git a/head.go b/head.go
index 30cbe61..92619a6 100644
--- a/head.go
+++ b/head.go
@@ -421,6 +421,10 @@ func (h *Head) loadWAL(r *wal.Reader) error {
 					if itv.Maxt < h.minValidTime {
 						continue
 					}
+					if m := h.series.getByID(s.ref); m == nil {
+						unknownRefs++
+						continue
+					}
 					allStones.addInterval(s.ref, itv)
 				}
 			}


Test patch:
diff --git a/head_test.go b/head_test.go
index 9e78b6b..79092dd 100644
--- a/head_test.go
+++ b/head_test.go
@@ -114,6 +114,9 @@ func TestHead_ReadWAL(t *testing.T) {
 			{Ref: 10, T: 101, V: 5},
 			{Ref: 50, T: 101, V: 6},
 		},
+		[]Stone{
+			{ref: 0, intervals: []Interval{{Mint: 99, Maxt: 101}}},
+		},
 	}
 	dir, err := ioutil.TempDir("", "test_read_wal")
 	testutil.Ok(t, err)
Repository: datreeio/datree
Pull request #7 (2021-04-18 11:33:10)

feat: Display errors from backend
* Print to the console in case backend returns status code > 399
* Exit code 1 in case of backend errors


Patch:
diff --git a/bl/evaluator.go b/bl/evaluator.go
index f394e98..463b0e8 100644
--- a/bl/evaluator.go
+++ b/bl/evaluator.go
@@ -55,7 +55,7 @@ func (e *Evaluator) Evaluate(pattern string, cliId string, evaluationConc int) (
 
 	res, err := e.cliClient.RequestEvaluation(pattern, files, cliId)
 	if err != nil {
-		return nil, fileErrors, fmt.Errorf("RequestEvaluation has failed")
+		return nil, fileErrors, err
 	}
 
 	results := e.aggregateEvaluationResults(res.Results)
diff --git a/pkg/httpClient/client.go b/pkg/httpClient/client.go
index 577696e..6a0468b 100644
--- a/pkg/httpClient/client.go
+++ b/pkg/httpClient/client.go
@@ -3,6 +3,7 @@ package httpClient
 import (
 	"bytes"
 	"encoding/json"
+	"fmt"
 	"io"
 	"io/ioutil"
 	"net/http"
@@ -57,6 +58,11 @@ func (c *Client) Request(method string, resourceURI string, body interface{}, he
 	if err != nil {
 		return responseBody, err
 	}
+
+	if response.StatusCode > 399 {
+		return responseBody, fmt.Errorf("Error: %v", string(b))
+	}
+
 	responseBody = Response{
 		StatusCode: response.StatusCode,
 		Body:       b,


Test patch:
diff --git a/bl/evaluator_test.go b/bl/evaluator_test.go
index 5f8a889..d97fddc 100644
--- a/bl/evaluator_test.go
+++ b/bl/evaluator_test.go
@@ -226,7 +226,7 @@ func test_evaluate_failedRequest() *evaluateTestCase {
 		}{
 			response:   nil,
 			fileErrors: []propertiesExtractor.FileError{},
-			err:        fmt.Errorf("RequestEvaluation has failed"),
+			err:        fmt.Errorf("error"),
 		},
 	}
 }
Repository: datreeio/datree
Pull request #10 (2021-04-18 14:32:57)

fix: count evaluated configs in cli


Patch:
diff --git a/.travis.yml b/.travis.yml
index 2dc5db9..5f8312f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,6 +5,7 @@ go:
 
 script:
   - go build -tags $DATREE_DEPLOYMENT
+  - go test ./...
   - curl -sfL https://git.io/goreleaser | VERSION=v$GORELEASER_VERSION sh -s -- check
 
 before_deploy:
diff --git a/bl/evaluator.go b/bl/evaluator.go
index 463b0e8..26babd6 100644
--- a/bl/evaluator.go
+++ b/bl/evaluator.go
@@ -58,7 +58,7 @@ func (e *Evaluator) Evaluate(pattern string, cliId string, evaluationConc int) (
 		return nil, fileErrors, err
 	}
 
-	results := e.aggregateEvaluationResults(res.Results)
+	results := e.aggregateEvaluationResults(res.Results, len(files))
 
 	return results, fileErrors, nil
 }
@@ -92,7 +92,7 @@ func (e *Evaluator) PrintFileParsingErrors(errors []propertiesExtractor.FileErro
 	}
 }
 
-func (e *Evaluator) aggregateEvaluationResults(evaluationResults []cliClient.EvaluationResult) *EvaluationResults {
+func (e *Evaluator) aggregateEvaluationResults(evaluationResults []cliClient.EvaluationResult, filesCount int) *EvaluationResults {
 	mapper := make(map[string]map[int]*Rule)
 
 	totalRulesCount := len(evaluationResults)
@@ -133,7 +133,7 @@ func (e *Evaluator) aggregateEvaluationResults(evaluationResults []cliClient.Eva
 		}{
 			RulesCount:       totalRulesCount,
 			TotalFailedRules: totalFailedCount,
-			FilesCount:       len(filenames),
+			FilesCount:       filesCount,
 		},
 	}
 


Test patch:
diff --git a/bl/evaluator_test.go b/bl/evaluator_test.go
index d97fddc..5bd6d35 100644
--- a/bl/evaluator_test.go
+++ b/bl/evaluator_test.go
@@ -171,7 +171,7 @@ func test_evaluate_success() *evaluateTestCase {
 					RulesCount       int
 					TotalFailedRules int
 					FilesCount       int
-				}{RulesCount: 1, TotalFailedRules: 0, FilesCount: 0},
+				}{RulesCount: 1, TotalFailedRules: 0, FilesCount: 1},
 			},
 			fileErrors: []propertiesExtractor.FileError{},
 			err:        nil,
@@ -182,7 +182,7 @@ func test_evaluate_success() *evaluateTestCase {
 func test_evaluate_failedRequest() *evaluateTestCase {
 	evaluationResponse := cliClient.EvaluationResponse{}
 	return &evaluateTestCase{
-		name: "success",
+		name: "fail",
 		args: struct {
 			pattern        string
 			cliId          string
Repository: datreeio/datree
Pull request #35 (2021-05-18 07:36:20)

fix:  typo in create invocation request


Patch:
diff --git a/pkg/cliClient/cliClient.go b/pkg/cliClient/cliClient.go
index a58b386..550ff19 100644
--- a/pkg/cliClient/cliClient.go
+++ b/pkg/cliClient/cliClient.go
@@ -85,7 +85,7 @@ type CreateEvaluationResponse struct {
 }
 
 func (c *CliClient) CreateEvaluation(request CreateEvaluationRequest) (int, error) {
-	res, err := c.httpClient.Request(http.MethodPost, "/cli/evaluate/create", request, nil)
+	res, err := c.httpClient.Request(http.MethodPost, "/cli/evaluation/create", request, nil)
 	if err != nil {
 		return 0, err
 	}


Test patch:
diff --git a/pkg/cliClient/cliClient_test.go b/pkg/cliClient/cliClient_test.go
index 0d72db7..3bf81be 100644
--- a/pkg/cliClient/cliClient_test.go
+++ b/pkg/cliClient/cliClient_test.go
@@ -334,7 +334,7 @@ func test_createEvaluation_success() *CreateEvaluationTestCase {
 				body   *CreateEvaluationResponse
 			}{
 				status: http.StatusOK,
-				body:   &CreateEvaluationResponse{
+				body: &CreateEvaluationResponse{
 					EvaluationId: 123,
 				},
 			},
@@ -355,7 +355,7 @@ func test_createEvaluation_success() *CreateEvaluationTestCase {
 				headers map[string]string
 			}{
 				method: http.MethodPost,
-				uri:    "/cli/evaluate/create",
+				uri:    "/cli/evaluation/create",
 				body: &CreateEvaluationRequest{
 					CliId: "cli_id",
 					Metadata: Metadata{
Repository: datreeio/datree
Pull request #54 (2021-05-31 17:31:12)

feat: display configs count


Patch:
diff --git a/bl/evaluation/printer.go b/bl/evaluation/printer.go
index 139cc2d..860f562 100644
--- a/bl/evaluation/printer.go
+++ b/bl/evaluation/printer.go
@@ -145,7 +145,7 @@ func (t OutputTitle) String() string {
 		"Total rules failed"}[t]
 }
 func parseEvaluationResultsToSummary(results *EvaluationResults, evaluationSummary printer.EvaluationSummary, loginURL string) printer.Summary {
-	filesCount := evaluationSummary.FilesCount
+	configsCount := evaluationSummary.ConfigsCount
 	rulesCount := 0
 	totalRulesEvaluated := 0
 	totalFailedRules := 0
@@ -167,7 +167,7 @@ func parseEvaluationResultsToSummary(results *EvaluationResults, evaluationSumma
 
 	plainRows := []printer.SummaryItem{
 		{LeftCol: EnabledRules.String(), RightCol: rulesCountRightCol, RowIndex: 0},
-		{LeftCol: EvaluatedConfigurations.String(), RightCol: fmt.Sprint(filesCount), RowIndex: 1},
+		{LeftCol: EvaluatedConfigurations.String(), RightCol: fmt.Sprint(configsCount), RowIndex: 1},
 		{LeftCol: TotalRulesEvaluated.String(), RightCol: fmt.Sprint(totalRulesEvaluated), RowIndex: 2},
 		{LeftCol: SeeAll.String(), RightCol: loginURL, RowIndex: 5},
 	}
diff --git a/pkg/printer/printer.go b/pkg/printer/printer.go
index 50e24b5..6cab9b6 100644
--- a/pkg/printer/printer.go
+++ b/pkg/printer/printer.go
@@ -92,6 +92,7 @@ type Summary struct {
 }
 
 type EvaluationSummary struct {
+	ConfigsCount              int
 	FilesCount                int
 	PassedYamlValidationCount int
 	PassedK8sValidationCount  int


Test patch:
diff --git a/cmd/test/main.go b/cmd/test/main.go
index 7cd1821..249356c 100644
--- a/cmd/test/main.go
+++ b/cmd/test/main.go
@@ -142,7 +142,9 @@ func test(ctx *TestCommandContext, paths []string, flags TestCommandFlags) error
 		passedPolicyCheckCount = results.Summary.TotalPassedCount
 	}
 
+	configsCount := countConfigurations(filesConfigurations)
 	evaluationSummary := printer.EvaluationSummary{
+		ConfigsCount:              configsCount,
 		FilesCount:                len(paths),
 		PassedYamlValidationCount: len(paths),
 		PassedK8sValidationCount:  len(filesConfigurations),
@@ -166,6 +168,16 @@ func test(ctx *TestCommandContext, paths []string, flags TestCommandFlags) error
 	return invocationFailedErr
 }
 
+func countConfigurations(filesConfigurations []*extractor.FileConfiguration) int {
+	totalConfigs := 0
+
+	for _, fileConfiguration := range filesConfigurations {
+		totalConfigs += len(fileConfiguration.Configurations)
+	}
+
+	return totalConfigs
+}
+
 func createSpinner(text string, color string) *spinner.Spinner {
 	s := spinner.New(spinner.CharSets[9], 100*time.Millisecond)
 	s.Suffix = text
Repository: datreeio/datree
Pull request #56 (2021-06-02 13:32:00)

staging


Patch:
diff --git a/bl/evaluation/printer.go b/bl/evaluation/printer.go
index 139cc2d..860f562 100644
--- a/bl/evaluation/printer.go
+++ b/bl/evaluation/printer.go
@@ -145,7 +145,7 @@ func (t OutputTitle) String() string {
 		"Total rules failed"}[t]
 }
 func parseEvaluationResultsToSummary(results *EvaluationResults, evaluationSummary printer.EvaluationSummary, loginURL string) printer.Summary {
-	filesCount := evaluationSummary.FilesCount
+	configsCount := evaluationSummary.ConfigsCount
 	rulesCount := 0
 	totalRulesEvaluated := 0
 	totalFailedRules := 0
@@ -167,7 +167,7 @@ func parseEvaluationResultsToSummary(results *EvaluationResults, evaluationSumma
 
 	plainRows := []printer.SummaryItem{
 		{LeftCol: EnabledRules.String(), RightCol: rulesCountRightCol, RowIndex: 0},
-		{LeftCol: EvaluatedConfigurations.String(), RightCol: fmt.Sprint(filesCount), RowIndex: 1},
+		{LeftCol: EvaluatedConfigurations.String(), RightCol: fmt.Sprint(configsCount), RowIndex: 1},
 		{LeftCol: TotalRulesEvaluated.String(), RightCol: fmt.Sprint(totalRulesEvaluated), RowIndex: 2},
 		{LeftCol: SeeAll.String(), RightCol: loginURL, RowIndex: 5},
 	}
diff --git a/pkg/printer/printer.go b/pkg/printer/printer.go
index 50e24b5..6cab9b6 100644
--- a/pkg/printer/printer.go
+++ b/pkg/printer/printer.go
@@ -92,6 +92,7 @@ type Summary struct {
 }
 
 type EvaluationSummary struct {
+	ConfigsCount              int
 	FilesCount                int
 	PassedYamlValidationCount int
 	PassedK8sValidationCount  int


Test patch:
diff --git a/cmd/test/main.go b/cmd/test/main.go
index 7cd1821..249356c 100644
--- a/cmd/test/main.go
+++ b/cmd/test/main.go
@@ -142,7 +142,9 @@ func test(ctx *TestCommandContext, paths []string, flags TestCommandFlags) error
 		passedPolicyCheckCount = results.Summary.TotalPassedCount
 	}
 
+	configsCount := countConfigurations(filesConfigurations)
 	evaluationSummary := printer.EvaluationSummary{
+		ConfigsCount:              configsCount,
 		FilesCount:                len(paths),
 		PassedYamlValidationCount: len(paths),
 		PassedK8sValidationCount:  len(filesConfigurations),
@@ -166,6 +168,16 @@ func test(ctx *TestCommandContext, paths []string, flags TestCommandFlags) error
 	return invocationFailedErr
 }
 
+func countConfigurations(filesConfigurations []*extractor.FileConfiguration) int {
+	totalConfigs := 0
+
+	for _, fileConfiguration := range filesConfigurations {
+		totalConfigs += len(fileConfiguration.Configurations)
+	}
+
+	return totalConfigs
+}
+
 func createSpinner(text string, color string) *spinner.Spinner {
 	s := spinner.New(spinner.CharSets[9], 100*time.Millisecond)
 	s.Suffix = text