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 | |
Andrew Geissler | 7d6e629 | 2018-05-24 12:06:58 -0700 | [diff] [blame] | 6 | var options = require('../gulp-options.js'), gulp = require('gulp'), |
| 7 | clean = require('gulp-clean'), eslint = require('gulp-eslint'); |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 8 | |
Andrew Geissler | 7d6e629 | 2018-05-24 12:06:58 -0700 | [diff] [blame] | 9 | var runSequence = require('run-sequence'), fs = require('fs'); |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 10 | |
Andrew Geissler | 7d6e629 | 2018-05-24 12:06:58 -0700 | [diff] [blame] | 11 | gulp.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 Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 17 | }); |
| 18 | |
Andrew Geissler | 7d6e629 | 2018-05-24 12:06:58 -0700 | [diff] [blame] | 19 | gulp.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 Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 26 | }); |
| 27 | |
Andrew Geissler | 7d6e629 | 2018-05-24 12:06:58 -0700 | [diff] [blame] | 28 | module.exports = function(callback) { |
| 29 | return runSequence('checkstyle:clean', 'checkstyle:eslint', callback); |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 30 | }; |