<commit_before>'use strict';

var gulp = require('gulp'),
    runSequence = require('run-sequence'),
    gutil = require('gulp-util'),
    jscs = require('gulp-jscs'),
    jshint = require('gulp-jshint'),
    tslint = require('gulp-tslint'),
    sasslint = require('gulp-scss-lint'),
    typedoc = require('gulp-typedoc'),
    react = require('gulp-react'),
    typescript = require('gulp-tsc'),
    sass = require('gulp-sass'),
    htmlcompress = require('gulp-minify-html'),
    autoprefixer = require('gulp-autoprefixer'),
    watch = require('gulp-watch'),
    plumber = require('gulp-plumber'),
    webpack = require('gulp-webpack'),
    //filelog = require('gulp-filelog'),  // NOTE: Used for debug
    //sourcemaps = require('gulp-sourcemaps'),
    livereload = require('gulp-livereload'),
    livereloadembed = require('gulp-embedlr'),

    openbrowser = require('open'),
    lazypipe = require('lazypipe'),

    //webpack = require('webpack'),
    //WebpackDevServer = require('webpack-dev-server'),

    config = {
        app: {
            js: [ './src/**/*.js' ],
            ts: [ './src/**/*.ts' ],
            jsx: [ './src/**/*.jsx' ],
            sass: [ './src/**/*.sass', './src/**/*.scss' ],
            html: [ './src/index.html' ]
        },
        build: {
            output: './build',
            content: './build/**/*.*',
            entry: './build/app.js',
            html: [ './build/index.html' ]
        },
        dist: {
            output: './dist',
            outputall: './dist/index.html'
        },
        server: {
            port: 8080,
            dir: './dist',
            livereload: false
        }
    },

    onError = function(err) {
        gutil.beep();
        gutil.log(gutil.colors.underline(gutil.colors.red('ERROR:')) +
            ' ' + gutil.colors.cyan(err.plugin) + ' - ' + err.message);
    },
    plumberDefault = lazypipe()
        .pipe(plumber, { errorHandler: onError }),

    jsFiles = function() {
        return gulp.src(config.app.js);
    },
    jshintTask = lazypipe()
        .pipe(jshint)
        .pipe(jshint.reporter, 'jshint-stylish'),
    jscsTask = lazypipe()
        .pipe(jscs),
    jslintTask = lazypipe()
        .pipe(jshintTask)
        .pipe(jscsTask),
    jscompileTask = lazypipe()
        .pipe(jslintTask)
        .pipe(gulp.dest, config.build.output),

    tsFiles = function() {
        return gulp.src(config.app.ts);
    },
    tslintTask = lazypipe()
        .pipe(tslint)
        .pipe(tslint.report, 'verbose'),
    tscompileTask = lazypipe()
        //.pipe(tslintTask)
        .pipe(typescript, { sourcemap: true })  // NOTE: sourcemap not currently supported
        .pipe(gulp.dest, config.build.output),

    // NOTE: jsxlint just compiles the jsx and then runs jshint anyway,
    jsxFiles = function() {
        return gulp.src(config.app.jsx);
    },
    jsxlintTask = lazypipe()
        .pipe(react)
        .pipe(jslintTask),
    jsxcompileTask = lazypipe()
        //.pipe(sourcemaps.init)            // NOTE: SourceMaps not currently supported
        .pipe(react, { sourceMap: true })
        //.pipe(sourcemaps.write, './')
        .pipe(jslintTask)
        .pipe(gulp.dest, config.build.output),

    sassFiles = function() {
        return gulp.src(config.app.sass);
    },
    sasslintTask = lazypipe()
        .pipe(sasslint),
    sasscompileTask = lazypipe()
        //.pipe(sass, {sourceComments: 'map'})
        .pipe(sass, { includePaths: [ './bower_components/bootstrap-sass-official/assets/stylesheets/' ] })
        .pipe(autoprefixer, [ 'last 2 version' ])
        .pipe(gulp.dest, config.build.output),

    htmlFiles = function() {
        return gulp.src(config.app.html);
    },
    htmlbuildFiles = function() {
        return gulp.src(config.build.html);
    },
    htmlcompileTask = lazypipe()
        .pipe(htmlcompress)
        .pipe(gulp.dest, config.build.output),
    htmlpackTask = lazypipe()
        .pipe(gulp.dest, config.dist.output),
    htmllivereloadembedTask = lazypipe()
        .pipe(livereloadembed)
        .pipe(gulp.dest, config.dist.output),

    buildentryFiles = function() {
        return gulp.src(config.build.entry);
    },
    packTask = lazypipe()
        .pipe(webpack, require('./webpack.config.js'))
        .pipe(gulp.dest, config.dist.output);

gulp.task('jshint', function() {
    return jsFiles().pipe(jshintTask());
});
gulp.task('jscs', function() {
    return jsFiles().pipe(jscsTask());
});
gulp.task('jslint', function() {
    return jsFiles().pipe(jslintTask());
});
gulp.task('tslint', function() {
    return tsFiles().pipe(tslintTask());
});
gulp.task('jsxlint', function() {
    return jsxFiles().pipe(jsxlintTask());
});
gulp.task('sasslint', function() {
    return sassFiles().pipe(sasslintTask()); // TODO: Need to get to work
});
gulp.task('lint', [ 'jslint', 'jsxlint', 'tslint'/*, 'sasslint'*/ ]);

gulp.task('jscompile', function() {
    return jsFiles().pipe(jscompileTask());<commit_msg>Comment out jsxhint for the moment as it sucks<commit_after>'use strict';

var gulp = require('gulp'),
    runSequence = require('run-sequence'),
    gutil = require('gulp-util'),
    jscs = require('gulp-jscs'),
    jshint = require('gulp-jshint'),
    tslint = require('gulp-tslint'),
    sasslint = require('gulp-scss-lint'),
    typedoc = require('gulp-typedoc'),
    react = require('gulp-react'),
    typescript = require('gulp-tsc'),
    sass = require('gulp-sass'),
    htmlcompress = require('gulp-minify-html'),
    autoprefixer = require('gulp-autoprefixer'),
    watch = require('gulp-watch'),
    plumber = require('gulp-plumber'),
    webpack = require('gulp-webpack'),
    //filelog = require('gulp-filelog'),  // NOTE: Used for debug
    //sourcemaps = require('gulp-sourcemaps'),
    livereload = require('gulp-livereload'),
    livereloadembed = require('gulp-embedlr'),

    openbrowser = require('open'),
    lazypipe = require('lazypipe'),

    //webpack = require('webpack'),
    //WebpackDevServer = require('webpack-dev-server'),

    config = {
        app: {
            js: [ './src/**/*.js' ],
            ts: [ './src/**/*.ts' ],
            jsx: [ './src/**/*.jsx' ],
            sass: [ './src/**/*.sass', './src/**/*.scss' ],
            html: [ './src/index.html' ]
        },
        build: {
            output: './build',
            content: './build/**/*.*',
            entry: './build/app.js',
            html: [ './build/index.html' ]
        },
        dist: {
            output: './dist',
            outputall: './dist/index.html'
        },
        server: {
            port: 8080,
            dir: './dist',
            livereload: false
        }
    },

    onError = function(err) {
        gutil.beep();
        gutil.log(gutil.colors.underline(gutil.colors.red('ERROR:')) +
            ' ' + gutil.colors.cyan(err.plugin) + ' - ' + err.message);
    },
    plumberDefault = lazypipe()
        .pipe(plumber, { errorHandler: onError }),

    jsFiles = function() {
        return gulp.src(config.app.js);
    },
    jshintTask = lazypipe()
        .pipe(jshint)
        .pipe(jshint.reporter, 'jshint-stylish'),
    jscsTask = lazypipe()
        .pipe(jscs),
    jslintTask = lazypipe()
        .pipe(jshintTask)
        .pipe(jscsTask),
    jscompileTask = lazypipe()
        .pipe(jslintTask)
        .pipe(gulp.dest, config.build.output),

    tsFiles = function() {
        return gulp.src(config.app.ts);
    },
    tslintTask = lazypipe()
        .pipe(tslint)
        .pipe(tslint.report, 'verbose'),
    tscompileTask = lazypipe()
        //.pipe(tslintTask)
        .pipe(typescript, { sourcemap: true })  // NOTE: sourcemap not currently supported
        .pipe(gulp.dest, config.build.output),

    // NOTE: jsxlint just compiles the jsx and then runs jshint anyway,
    jsxFiles = function() {
        return gulp.src(config.app.jsx);
    },
    //jsxlintTask = lazypipe()
    //    .pipe(react)
    //    .pipe(jslintTask),                // NOTE: jslint doesn't work very well atm
    jsxcompileTask = lazypipe()
        //.pipe(sourcemaps.init)            // NOTE: SourceMaps not currently supported
        .pipe(react, { sourceMap: true })
        //.pipe(sourcemaps.write, './')
        //.pipe(jslintTask)                 // NOTE: jslint doesn't work very well atm
        .pipe(gulp.dest, config.build.output),

    sassFiles = function() {
        return gulp.src(config.app.sass);
    },
    sasslintTask = lazypipe()
        .pipe(sasslint),
    sasscompileTask = lazypipe()
        //.pipe(sass, {sourceComments: 'map'})
        .pipe(sass, { includePaths: [ './bower_components/bootstrap-sass-official/assets/stylesheets/' ] })
        .pipe(autoprefixer, [ 'last 2 version' ])
        .pipe(gulp.dest, config.build.output),

    htmlFiles = function() {
        return gulp.src(config.app.html);
    },
    htmlbuildFiles = function() {
        return gulp.src(config.build.html);
    },
    htmlcompileTask = lazypipe()
        .pipe(htmlcompress)
        .pipe(gulp.dest, config.build.output),
    htmlpackTask = lazypipe()
        .pipe(gulp.dest, config.dist.output),
    htmllivereloadembedTask = lazypipe()
        .pipe(livereloadembed)
        .pipe(gulp.dest, config.dist.output),

    buildentryFiles = function() {
        return gulp.src(config.build.entry);
    },
    packTask = lazypipe()
        .pipe(webpack, require('./webpack.config.js'))
        .pipe(gulp.dest, config.dist.output);

gulp.task('jshint', function() {
    return jsFiles().pipe(jshintTask());
});
gulp.task('jscs', function() {
    return jsFiles().pipe(jscsTask());
});
gulp.task('jslint', function() {
    return jsFiles().pipe(jslintTask());
});
gulp.task('tslint', function() {
    return tsFiles().pipe(tslintTask());
});
gulp.task('jsxlint', function() {
    //return jsxFiles().pipe(jsxlintTask()); // NOTE: jslint doesn't work very well atm
});
gulp.task('sasslint', function() {
    return sassFiles().pipe(sasslintTask()); // TODO: Need to get to work
});
gulp.task('lint', [ 'jslint', 'jsxlint', 'tslint'/*, 'sasslint'*/ ]);

gulp.task('jscompile', function() {
    return jsFiles().pipe(jscompileTask());
{'fraction_non_alphanumeric': 0.17695108749138863, 'fraction_numerical': 0.0009841551028442082, 'mean_word_length': 2.353795379537954, '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': '1138989', 'n_tokens_mistral': 3436, 'n_tokens_neox': 3326, 'n_words': 566}