mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
MDL-56519 behat: Lint gherkin files
This commit is contained in:
parent
c4cf1c60f5
commit
8b02e2d98c
20
.gherkin-lintrc
Normal file
20
.gherkin-lintrc
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"no-files-without-scenarios" : "on",
|
||||
"no-unamed-features": "on",
|
||||
"no-unamed-scenarios": "on",
|
||||
"no-dupe-scenario-names": "off",
|
||||
"no-dupe-feature-names": "on",
|
||||
"no-partially-commented-tag-lines": "on",
|
||||
"indentation": ["on",{
|
||||
"Feature": 0,
|
||||
"Background": 2,
|
||||
"Scenario": 0,
|
||||
"Step": 4,
|
||||
"given": 4,
|
||||
"and": 4
|
||||
}],
|
||||
"no-trailing-spaces": "on",
|
||||
"no-multiple-empty-lines": "on",
|
||||
"no-empty-file": "on",
|
||||
"no-scenario-outlines-without-examples": "on"
|
||||
}
|
23
Gruntfile.js
23
Gruntfile.js
@ -106,7 +106,6 @@ module.exports = function(grunt) {
|
||||
return libs;
|
||||
};
|
||||
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
eslint: {
|
||||
@ -178,6 +177,11 @@ module.exports = function(grunt) {
|
||||
paths: [cwd]
|
||||
}
|
||||
},
|
||||
gherkinlint: {
|
||||
options: {
|
||||
files: ['**/tests/behat/*.feature'],
|
||||
}
|
||||
},
|
||||
stylelint: {
|
||||
less: {
|
||||
options: {
|
||||
@ -318,6 +322,22 @@ module.exports = function(grunt) {
|
||||
}, done);
|
||||
};
|
||||
|
||||
tasks.gherkinlint = function() {
|
||||
var done = this.async(),
|
||||
options = grunt.config('gherkinlint.options');
|
||||
|
||||
var args = grunt.file.expand(options.files);
|
||||
args.unshift(path.normalize(__dirname + '/node_modules/.bin/gherkin-lint'));
|
||||
grunt.util.spawn({
|
||||
cmd: 'node',
|
||||
args: args,
|
||||
opts: {stdio: 'inherit', env: process.env}
|
||||
}, function(error, result, code) {
|
||||
// Propagate the exit code.
|
||||
done(code);
|
||||
});
|
||||
};
|
||||
|
||||
tasks.startup = function() {
|
||||
// Are we in a YUI directory?
|
||||
if (path.basename(path.resolve(cwd, '../../')) == 'yui') {
|
||||
@ -360,6 +380,7 @@ module.exports = function(grunt) {
|
||||
|
||||
// Register JS tasks.
|
||||
grunt.registerTask('shifter', 'Run Shifter against the current directory', tasks.shifter);
|
||||
grunt.registerTask('gherkinlint', 'Run gherkinlint against the current directory', tasks.gherkinlint);
|
||||
grunt.registerTask('ignorefiles', 'Generate ignore files for linters', tasks.ignorefiles);
|
||||
grunt.registerTask('yui', ['eslint:yui', 'shifter']);
|
||||
grunt.registerTask('amd', ['eslint:amd', 'uglify']);
|
||||
|
10
npm-shrinkwrap.json
generated
10
npm-shrinkwrap.json
generated
@ -915,6 +915,16 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"gherkin": {
|
||||
"version": "4.0.0",
|
||||
"from": "gherkin@4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/gherkin/-/gherkin-4.0.0.tgz"
|
||||
},
|
||||
"gherkin-lint": {
|
||||
"version": "1.1.3",
|
||||
"from": "gherkin-lint@>=1.1.3 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/gherkin-lint/-/gherkin-lint-1.1.3.tgz"
|
||||
},
|
||||
"glob": {
|
||||
"version": "7.0.5",
|
||||
"from": "https://registry.npmjs.org/glob/-/glob-7.0.5.tgz",
|
||||
|
@ -5,6 +5,7 @@
|
||||
"devDependencies": {
|
||||
"async": "1.5.2",
|
||||
"eslint": "3.7.1",
|
||||
"gherkin-lint": "1.1.3",
|
||||
"grunt": "1.0.1",
|
||||
"grunt-contrib-less": "1.3.0",
|
||||
"grunt-contrib-uglify": "1.0.1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user