gherkin-lint
Advanced tools
Comparing version 1.1.3 to 2.0.0
{ | ||
"name": "gherkin-lint", | ||
"version": "1.1.3", | ||
"version": "2.0.0", | ||
"description": "A Gherkin linter/validator written in javascript", | ||
@@ -12,2 +12,8 @@ "author": "Vasiliki Siakka", | ||
"name": "Oskar Pfeifer-Bley" | ||
}, | ||
{ | ||
"name": "Xavier Garcia Buils" | ||
}, | ||
{ | ||
"name": "Rene Saarsoo" | ||
} | ||
@@ -43,5 +49,6 @@ ], | ||
"lint": "eslint .", | ||
"test": "npm run lint && mocha --recursive" | ||
"mocha": "mocha --recursive", | ||
"test": "npm run lint && npm run mocha" | ||
}, | ||
"license": "ISC" | ||
} |
@@ -40,4 +40,4 @@ # Gherkin lint | ||
| `no-trailing-spaces` | Disallows trailing spaces | yes | | ||
| `no-unamed-features` | Disallows empty Feature name | yes | | ||
| `no-unamed-scenarios` | Disallows empty Scenario name | yes | | ||
| `no-unnamed-features` | Disallows empty Feature name | yes | | ||
| `no-unnamed-scenarios` | Disallows empty Scenario name | yes | | ||
| `new-line-at-eof` | Disallows/enforces new line at EOF | yes | | ||
@@ -54,6 +54,6 @@ | `no-scenario-outlines-without-examples` | Disallows scenario outlines without examples | yes | | ||
{ | ||
"no-unamed-features": "on" | ||
"no-unnamed-features": "on" | ||
} | ||
``` | ||
will turn on the `no-unamed-features` rule. | ||
will turn on the `no-unnamed-features` rule. | ||
@@ -60,0 +60,0 @@ `indentation` can be configured in a more granular level and uses following rules by default: |
@@ -5,5 +5,6 @@ var fs = require('fs'); | ||
var defaultConfigFileName = '.gherkin-lintrc'; | ||
var errors = []; | ||
var errors; | ||
function getConfiguration(configPath) { | ||
errors = []; | ||
if (configPath) { | ||
@@ -10,0 +11,0 @@ if (!fs.existsSync(configPath)) { |
@@ -9,5 +9,6 @@ // Operations on rules | ||
if (!rules) { | ||
rules = []; | ||
rules = {}; | ||
fs.readdirSync(path.join(__dirname, 'rules')).forEach(function(file) { | ||
rules.push(require(path.join(__dirname, 'rules', file))); | ||
var ruleName = file.replace(/\.js$/, ''); | ||
rules[ruleName] = require(path.join(__dirname, 'rules', file)); | ||
}); | ||
@@ -19,12 +20,7 @@ } | ||
function getRule(rule) { | ||
var rules = getAllRules(); | ||
for (var i = 0; i < rules.length; i ++) { | ||
if (rules[i].name === rule) { | ||
return rules[i]; | ||
} | ||
} | ||
return getAllRules()[rule]; | ||
} | ||
function doesRuleExist(rule) { | ||
return getRule(rule) != undefined; | ||
return getRule(rule) !== undefined; | ||
} | ||
@@ -42,3 +38,5 @@ | ||
var ignoreFutureErrors = false; | ||
getAllRules().forEach(function(rule) { | ||
var rules = getAllRules(); | ||
Object.keys(rules).forEach(function(ruleName) { | ||
var rule = rules[ruleName]; | ||
if (isRuleEnabled(configuration[rule.name]) && !ignoreFutureErrors) { | ||
@@ -45,0 +43,0 @@ var ruleConfig = Array.isArray(configuration[rule.name]) ? configuration[rule.name][1] : {}; |
@@ -5,4 +5,4 @@ module.exports = | ||
'no-files-without-scenarios': 'on', | ||
'no-unamed-features': 'on', | ||
'no-unamed-scenarios': 'on', | ||
'no-unnamed-features': 'on', | ||
'no-unnamed-scenarios': 'on', | ||
'no-dupe-scenario-names': 'on', | ||
@@ -9,0 +9,0 @@ 'no-dupe-feature-names': 'on', |
@@ -29,3 +29,3 @@ var assert = require('chai').assert; | ||
describe('parsing/verification throws an error when the config contails', function() { | ||
describe('parsing/verification throws an error when the config contains', function() { | ||
beforeEach(function() { | ||
@@ -50,5 +50,6 @@ this.sinon.stub(console, 'error'); | ||
// 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); | ||
}); | ||
@@ -71,5 +72,6 @@ | ||
// 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); | ||
@@ -76,0 +78,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50471
66
1011
10