<commit_before>// This file is in charge of the build process:
// Running tests, checking code quality, minifying the code, etc.

'use strict';

// Include gulp
var gulp = require('gulp');
var istanbul = require('gulp-istanbul');


/*
 * QUALITY tasks.
 */
gulp.task('lint', function() {
  var jshint = require('gulp-jshint');
  var gjslint = require('gulp-gjslint');

  // 80 characters per line is too restrictive!
  var lintOptions = {
    flags: ['--nojsdoc', '--max_line_length 150', '--custom_jsdoc_tags "property, callback"']
  };

  return gulp.src(['./lib/*.js', './test/*.js', './gulpfile.js'])
    .pipe(jshint())
    .pipe(jshint.reporter('default'))
    .pipe(gjslint(lintOptions))
    .pipe(gjslint.reporter('console'));
});


/*
 * Tasks for UNIT tests.
 */
gulp.task('pre-test', function() {

  gulp.src(['./lib/*.js'])
    .pipe(istanbul({
      includeUntested: true
    }))
    .pipe(istanbul.hookRequire());<commit_msg>#13 Fail the build when linting fails<commit_after>// This file is in charge of the build process:
// Running tests, checking code quality, minifying the code, etc.

'use strict';

// Include gulp
var gulp = require('gulp');
var istanbul = require('gulp-istanbul');


/*
 * QUALITY tasks.
 */
gulp.task('lint', function() {
  var jshint = require('gulp-jshint');
  var gjslint = require('gulp-gjslint');

  // 80 characters per line is too restrictive!
  var lintOptions = {
    flags: ['--nojsdoc', '--max_line_length 150', '--custom_jsdoc_tags "property, callback"']
  };

  return gulp.src(['./lib/*.js', './test/*.js', './gulpfile.js'])
    .pipe(jshint())
    .pipe(jshint.reporter('default'))
    .pipe(gjslint(lintOptions))
    .pipe(gjslint.reporter('console', {fail: true}))
    .pipe(jshint.reporter('fail'));
});


/*
 * Tasks for UNIT tests.
 */
gulp.task('pre-test', function() {

  gulp.src(['./lib/*.js'])
    .pipe(istanbul({
      includeUntested: true
    }))
    .pipe(istanbul.hookRequire());
{'fraction_non_alphanumeric': 0.19425935417734494, 'fraction_numerical': 0.006150691952844695, 'mean_word_length': 3.4566210045662102, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7002528', 'n_tokens_mistral': 722, 'n_tokens_neox': 691, 'n_words': 156}