blob: 0826352ccadccd86c517594e9c931066bb7af331 [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
Andrew Geissler7d6e6292018-05-24 12:06:58 -07006var options = require('../gulp-options.js'), gulp = require('gulp'),
7 clean = require('gulp-clean'), eslint = require('gulp-eslint');
Iftekharul Islam99d199f2017-03-24 15:28:25 -05008
Andrew Geissler7d6e6292018-05-24 12:06:58 -07009var runSequence = require('run-sequence'), fs = require('fs');
Iftekharul Islam99d199f2017-03-24 15:28:25 -050010
Andrew Geissler7d6e6292018-05-24 12:06:58 -070011gulp.task('checkstyle:clean', function() {
12 return gulp
13 .src(
14 [options.targetFolderPath + '/eslint-report-checkstyle.xml'],
15 {'read': false})
16 .pipe(clean({'force': true}));
Iftekharul Islam99d199f2017-03-24 15:28:25 -050017});
18
Andrew Geissler7d6e6292018-05-24 12:06:58 -070019gulp.task('checkstyle:eslint', function() {
20 return gulp.src([options.srcFolderPath + '/**/*.js', options.excludePath])
21 .pipe(eslint({'useEslintrc': true}))
22 .pipe(eslint.format('checkstyle', function(output) {
23 fs.writeFileSync(
24 options.targetFolderPath + '/eslint-report-checkstyle.xml', output);
25 }));
Iftekharul Islam99d199f2017-03-24 15:28:25 -050026});
27
Andrew Geissler7d6e6292018-05-24 12:06:58 -070028module.exports = function(callback) {
29 return runSequence('checkstyle:clean', 'checkstyle:eslint', callback);
Iftekharul Islam99d199f2017-03-24 15:28:25 -050030};