<commit_before>
import gulp             from 'gulp'
import gutil            from 'gulp-util'
import through2         from 'through2'
import { readFileSync } from 'fs'
import { resolve }      from 'path'

import jshint           from 'gulp-jshint'

import Checker          from 'jscs'
import * as configFile  from 'jscs/lib/cli-config'
import ConsoleReporter  from 'jscs/lib/reporters/console'

let paths = {
  scripts: [
    __dirname + '/../www/src/**/*.js',
    __dirname + '/../tasks/**/*.js',
  ]
}

gulp.task('lint', ['lint:jshint', 'lint:jscs'])

gulp.task('lint:jshint', function() {
  return gulp.src(paths.scripts)
    .pipe(jshint())
    .pipe(jshint.reporter('default'))
})

function collectFiles(src) {
  return new Promise(function(resolve, reject) {
    var files = []
    src.on('data',  item => files.push(item))
    src.on('end',     () => resolve(files))
    src.on('error'   , e => reject(error))
  })
}

gulp.task('lint:jscs', function() {
  let checker = new Checker({ esnext: true })<commit_msg>Make task fail on jshint error.<commit_after>
import gulp             from 'gulp'
import gutil            from 'gulp-util'
import through2         from 'through2'
import { readFileSync } from 'fs'
import { resolve }      from 'path'

import jshint           from 'gulp-jshint'

import Checker          from 'jscs'
import * as configFile  from 'jscs/lib/cli-config'
import ConsoleReporter  from 'jscs/lib/reporters/console'

let paths = {
  scripts: [
    __dirname + '/../www/src/**/*.js',
    __dirname + '/../tasks/**/*.js',
  ]
}

gulp.task('lint', ['lint:jshint', 'lint:jscs'])

gulp.task('lint:jshint', function() {
  return gulp.src(paths.scripts)
    .pipe(jshint())
    .pipe(jshint.reporter('default'))
    .pipe(jshint.reporter('fail'))
})

function collectFiles(src) {
  return new Promise(function(resolve, reject) {
    var files = []
    src.on('data',  item => files.push(item))
    src.on('end',     () => resolve(files))
    src.on('error'   , e => reject(error))
  })
}

gulp.task('lint:jscs', function() {
  let checker = new Checker({ esnext: true })
{'fraction_non_alphanumeric': 0.17105893627216098, 'fraction_numerical': 0.0019166267369429804, 'mean_word_length': 2.984732824427481, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6222022', 'n_tokens_mistral': 742, 'n_tokens_neox': 739, 'n_words': 162}