nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: vsiakka/gherkin-lint
Pull request #55 (2016-09-11 17:38:06)

fix configParser.getConfiguration side effect
Hi,

This is the PR to solve the side effect in `getConfiguration` method metioned in #54 

Thanks!


Patch:
diff --git a/src/config-parser.js b/src/config-parser.js
index 0f64149..76d15a9 100644
--- a/src/config-parser.js
+++ b/src/config-parser.js
@@ -2,9 +2,10 @@ var fs = require('fs');
 var rules = require('./rules.js');
 
 var defaultConfigFileName = '.gherkin-lintrc';
-var errors = [];
+var errors;
 
 function getConfiguration(configPath) {
+  errors = [];
   if (configPath) {
     if (!fs.existsSync(configPath)) {
       throw new Error('Could not find specified config file "' + configPath + '"');


Test patch:
diff --git a/test/configuration-parser/test.js b/test/configuration-parser/test.js
index 686914f..df6451f 100644
--- a/test/configuration-parser/test.js
+++ b/test/configuration-parser/test.js
@@ -26,7 +26,7 @@ describe('Configuration file', function() {
     });
   });
 
-  describe('parsing/verification throws an error when the config contails', function() {
+  describe('parsing/verification throws an error when the config contains', function() {
     beforeEach(function() {
       this.sinon.stub(console, 'error');
     });
@@ -46,9 +46,10 @@ describe('Configuration file', function() {
       assert.equal(actualAssertion, expectedAssertion);
 
       // verify the console logs
-      expected.consoleErrors.forEach(function(msg) {
-        expect(console.error.calledWith(msg)).to.be.true; // eslint-disable-line no-console
+      var consoleErrorArgs = console.error.args.map(function (args) { // eslint-disable-line no-console
+        return args[0];
       });
+      expect(consoleErrorArgs).to.be.deep.equal(expected.consoleErrors);
     });
 
     it('a non existing rule sub-config', function() {
@@ -66,9 +67,10 @@ describe('Configuration file', function() {
       assert.equal(actualAssertion, expectedAssertion);
 
       // verify the console logs
-      expected.consoleErrors.forEach(function(msg) {
-        expect(console.error.calledWith(msg)).to.be.true; // eslint-disable-line no-console
+      var consoleErrorArgs = console.error.args.map(function (args) { // eslint-disable-line no-console
+        return args[0];
       });
+      expect(consoleErrorArgs).to.be.deep.equal(expected.consoleErrors);
 
     });
Repository: vsiakka/gherkin-lint
Pull request #83 (2017-09-11 04:33:23)

fix: do not pick up duplicates
Currently, it is possible to get errors (for example for unique scenario names) by passing something like: `gherkin-lint src src/x.feature` - `x.feature` would be picked up twice and then error.
This PR fixes this.

cc @brendanAnnable


Patch:
diff --git a/src/feature-finder.js b/src/feature-finder.js
index f168f97..5c992d1 100644
--- a/src/feature-finder.js
+++ b/src/feature-finder.js
@@ -1,3 +1,4 @@
+var _ = require('lodash');
 var glob = require('glob');
 var fs = require('fs');
 var path = require('path');
@@ -35,7 +36,7 @@ function getFeatureFiles(args, ignoreArg) {
     var globOptions = {ignore: getIgnorePatterns(ignoreArg)};
     files = files.concat(glob.sync(fixedPattern, globOptions));
   });
-  return files;
+  return _.uniq(files);
 }
 
 function getIgnorePatterns(ignoreArg) {


Test patch:
diff --git a/test/configuration-parser/test.js b/test/configuration-parser/test.js
index df6451f..79b6244 100644
--- a/test/configuration-parser/test.js
+++ b/test/configuration-parser/test.js
@@ -3,7 +3,7 @@ var expect = require('chai').expect;
 var configParser = require('../../src/config-parser.js');
 var expectedResults = require('./test-results/results.js');
 
-require('mocha-sinon');
+require('mocha-sinon')();
 
 describe('Configuration file', function() {
   describe('parsing/verification is successful when', function() {
@@ -27,8 +27,13 @@ describe('Configuration file', function() {
   });
 
   describe('parsing/verification throws an error when the config contains', function() {
+    var stub;
     beforeEach(function() {
-      this.sinon.stub(console, 'error');
+      stub = this.sinon.stub(console, 'error');
+    });
+
+    afterEach(function() {
+      stub.restore();
     });
 
     it('a non existing rule', function() {
diff --git a/test/feature-finder/fixtures/a.feature b/test/feature-finder/fixtures/a.feature
new file mode 100644
index 0000000..e69de29
diff --git a/test/feature-finder/test.js b/test/feature-finder/test.js
new file mode 100644
index 0000000..1ee6918
--- /dev/null
+++ b/test/feature-finder/test.js
@@ -0,0 +1,12 @@
+var assert = require('chai').assert;
+var featureFinder = require('../../src/feature-finder.js');
+
+describe('Feature finder', function() {
+  it('does not return duplicates', function() {
+    var actual = featureFinder.getFeatureFiles([
+      'test/feature-finder/fixtures',
+      'test/feature-finder'
+    ]);
+    assert.deepEqual(actual, ['test/feature-finder/fixtures/a.feature']);
+  });
+});