Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 1 | /*eslint-env node */ |
| 2 | /*global require: true, module: true */ |
| 3 | |
| 4 | 'use strict'; |
| 5 | |
| 6 | var options = require('../gulp-options.js'), |
| 7 | gulp = require('gulp'), |
| 8 | clean = require('gulp-clean'), |
| 9 | eslint = require('gulp-eslint'); |
| 10 | |
| 11 | var runSequence = require('run-sequence'), |
| 12 | fs = require('fs'); |
| 13 | |
| 14 | gulp.task('checkstyle:clean', function () { |
| 15 | return gulp |
| 16 | .src([options.targetFolderPath + '/eslint-report-checkstyle.xml'], {'read': false}) |
| 17 | .pipe(clean({'force': true})); |
| 18 | }); |
| 19 | |
| 20 | gulp.task('checkstyle:eslint', function () { |
| 21 | return gulp |
| 22 | .src([options.srcFolderPath + '/**/*.js', options.excludePath]) |
| 23 | .pipe(eslint({'useEslintrc': true})) |
| 24 | .pipe(eslint.format('checkstyle', function (output) { |
| 25 | fs.writeFileSync(options.targetFolderPath + '/eslint-report-checkstyle.xml', output); |
| 26 | })); |
| 27 | }); |
| 28 | |
| 29 | module.exports = function (callback) { |
| 30 | return runSequence('checkstyle:clean', 'checkstyle:eslint', callback); |
| 31 | }; |