blob: bd76a8b1f3ca79b317e1bc3d3e7733728aae5ce2 [file] [log] [blame]
Iftekharul Islam99d199f2017-03-24 15:28:25 -05001/*eslint-env node */
2/*global require: true, module: true */
3
4'use strict';
5
6var options = require('../gulp-options.js'),
7 gulp = require('gulp'),
8 clean = require('gulp-clean'),
9 eslint = require('gulp-eslint');
10
11var runSequence = require('run-sequence'),
12 fs = require('fs');
13
14gulp.task('checkstyle:clean', function () {
15 return gulp
16 .src([options.targetFolderPath + '/eslint-report-checkstyle.xml'], {'read': false})
17 .pipe(clean({'force': true}));
18});
19
20gulp.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
29module.exports = function (callback) {
30 return runSequence('checkstyle:clean', 'checkstyle:eslint', callback);
31};