<commit_before>var gulp          = require('gulp');
var plugins       = require('gulp-load-plugins')();
var templatecache = require('gulp-angular-templatecache');
var karma         = require('karma').server;
var _             = require('lodash');
var browserSync   = require('browser-sync');
var at            = require('gulp-asset-transform');
var protractor    = require('gulp-protractor').protractor;
var del           = require('del');

var paths = {
  css         : ['src/assets/css/*.css', 'src/app/**/*.css'],
  fonts       : 'src/assets/fonts/*.*',
  images      : 'src/assets/images/**',
  index       : 'src/index.html',
  integration : 'test/integration/*.js',
  js          : 'src/app/**/*.js',
  less        : ['src/assets/less/*.less', 'src/app/**/**/*.less'],
  templates   : 'src/app/components/**/*.html'
};

var config = {
  jshint : 'config/jshint.conf',
  karma  : require('./config/karma.conf')
};


gulp.task('copy-images', function() {
  return gulp.src(paths.images)
    .pipe(plugins.plumber())
    .pipe(plugins.imagemin({ optimizationLevel: 3, progressive: true, interlaced: true }))
    .pipe(plugins.size({ title: 'images', showFiles: true }))
    .pipe(gulp.dest('develop/images'));
});

gulp.task('copy-fonts', function() {
  return gulp.src(paths.fonts)
    .pipe(plugins.plumber())
    .pipe(plugins.size({ title: 'fonts' }))
    .pipe(gulp.dest('develop/fonts'));
});

gulp.task('at-build', function() {
  return gulp.src(paths.index)
    .pipe(plugins.plumber())
    .pipe(at({
      css: {
        tasks: ['concat',
                plugins.size({ title: 'css', showFiles: true })]
      },
      js: {
        tasks: ['concat',
                plugins.size({ title: 'js', showFiles: true })]
      },
      js_lib: {
        tasks: ['concat',
                plugins.size({ title: 'js_lib', showFiles: true })]
      },
      less: {
        tasks: [plugins.recess(),
                plugins.recess.reporter(),
                plugins.less(),
                'concat',
                plugins.size({ title: 'less', showFiles: true})]
      }
    }))
    .pipe(gulp.dest('develop/'))
    .pipe(browserSync.reload({ stream: true }));
});

gulp.task('templates', function () {
  return gulp.src(paths.templates)
    .pipe(plugins.plumber())
    .pipe(templatecache('templates.js', { standalone: true }))
    .pipe(plugins.size({ title: 'templates' }))
    .pipe(gulp.dest('develop/js'))
    .pipe(browserSync.reload({ stream: true }));
});

gulp.task('jshint', function() {
  gulp.src(paths.js)
    .pipe(plugins.jshint(config.jshint))
    .pipe(plugins.jshint.reporter('jshint-stylish'));
});


gulp.task('clean', function(done) {
  del(['develop/**'], done);
});


gulp.task('karma', function(done) {
  karma.start(_.assign({}, config.karma, { singleRun: true, colors: true }), done);
});

gulp.task('karma-ci', function(done) {
  karma.start(_.assign({}, config.karma, { singleRun: false, colors: true, autoWatch: true }), done);
});

gulp.task('integration', ['server'], function(done) {
// gulp.task('integration', function(done) {
  gulp.src(paths.integration)
    .pipe(protractor({
      configFile: 'config/protractor.conf',
      args: ['--baseUrl', 'http://localhost:3000/#/']
    }))
    .on('error', function(e) { browserSync.exit(); throw e; })
    .on('end', function() { browserSync.exit(); done(); });
    // .on('error', function(e) { throw e; })
    // .on('end', function() { done(); });
});


gulp.task('server', function() {
  browserSync({
    server: {
      baseDir: 'develop'
    },
    logConnections: true,
    open: false
  });
});

gulp.task('watch', function() {
  gulp.watch([paths.index, paths.css, paths.less, paths.js], ['at-build']);
  gulp.watch([paths.images, paths.fonts], ['copy-assets']);
  gulp.watch([paths.templates], ['templates']);
  gulp.watch([paths.js], ['jshint']);
});

gulp.task('copy-assets', ['copy-images', 'copy-fonts']);
gulp.task('build', ['at-build', 'templates', 'copy-assets']);
gulp.task('develop', ['build', 'server', 'watch', 'karma-ci']);<commit_msg>Move less linting to own task instead of in at-pipeline<commit_after>var gulp          = require('gulp');
var plugins       = require('gulp-load-plugins')();
var templatecache = require('gulp-angular-templatecache');
var karma         = require('karma').server;
var _             = require('lodash');
var browserSync   = require('browser-sync');
var at            = require('gulp-asset-transform');
var protractor    = require('gulp-protractor').protractor;
var del           = require('del');

var paths = {
  css         : ['src/assets/css/*.css', 'src/app/**/*.css'],
  fonts       : 'src/assets/fonts/*.*',
  images      : 'src/assets/images/**',
  index       : 'src/index.html',
  integration : 'test/integration/*.js',
  js          : 'src/app/**/*.js',
  less        : ['src/assets/less/*.less', 'src/app/components/**/*.less'],
  templates   : 'src/app/components/**/*.html'
};

var config = {
  jshint : 'config/jshint.conf',
  karma  : require('./config/karma.conf')
};


gulp.task('copy-images', function() {
  return gulp.src(paths.images)
    .pipe(plugins.plumber())
    .pipe(plugins.imagemin({ optimizationLevel: 3, progressive: true, interlaced: true }))
    .pipe(plugins.size({ title: 'images', showFiles: true }))
    .pipe(gulp.dest('develop/images'));
});

gulp.task('copy-fonts', function() {
  return gulp.src(paths.fonts)
    .pipe(plugins.plumber())
    .pipe(plugins.size({ title: 'fonts' }))
    .pipe(gulp.dest('develop/fonts'));
});

gulp.task('at-build', function() {
  return gulp.src(paths.index)
    .pipe(plugins.plumber())
    .pipe(at({
      css: {
        tasks: ['concat',
                plugins.size({ title: 'css', showFiles: true })]
      },
      js: {
        tasks: ['concat',
                plugins.size({ title: 'js', showFiles: true })]
      },
      js_lib: {
        tasks: ['concat',
                plugins.size({ title: 'js_lib', showFiles: true })]
      },
      less: {
        tasks: [plugins.less(),
                'concat',
                plugins.size({ title: 'less', showFiles: true})]
      }
    }))
    .pipe(gulp.dest('develop/'))
    .pipe(browserSync.reload({ stream: true }));
});

gulp.task('templates', function () {
  return gulp.src(paths.templates)
    .pipe(plugins.plumber())
    .pipe(templatecache('templates.js', { standalone: true }))
    .pipe(plugins.size({ title: 'templates' }))
    .pipe(gulp.dest('develop/js'))
    .pipe(browserSync.reload({ stream: true }));
});

gulp.task('jshint', function() {
  gulp.src(paths.js)
    .pipe(plugins.jshint(config.jshint))
    .pipe(plugins.jshint.reporter('jshint-stylish'));
});

gulp.task('less-lint', function() {
  gulp.src(paths.less)
    .pipe(plugins.plumber())
    .pipe(plugins.recess())
    .pipe(plugins.recess.reporter());
});


gulp.task('clean', function(done) {
  del(['develop/**'], done);
});


gulp.task('karma', function(done) {
  karma.start(_.assign({}, config.karma, { singleRun: true, colors: true }), done);
});

gulp.task('karma-ci', function(done) {
  karma.start(_.assign({}, config.karma, { singleRun: false, colors: true, autoWatch: true }), done);
});

gulp.task('integration', ['server'], function(done) {
  gulp.src(paths.integration)
    .pipe(protractor({
      configFile: 'config/protractor.conf',
      args: ['--baseUrl', 'http://localhost:3000/#/']
    }))
    .on('error', function(e) { browserSync.exit(); throw e; })
    .on('end', function() { browserSync.exit(); done(); });
});


gulp.task('server', function() {
  browserSync({
    server: {
      baseDir: 'develop'
    },
    logConnections: true,
    open: false
  });
});

gulp.task('watch', function() {
  gulp.watch([paths.index, paths.css, paths.less, paths.js], ['at-build']);
  gulp.watch([paths.images, paths.fonts], ['copy-assets']);
  gulp.watch([paths.templates], ['templates']);
  gulp.watch([paths.js], ['jshint']);
  gulp.watch([paths.less], ['less-lint']);
});

gulp.task('copy-assets', ['copy-images', 'copy-fonts']);
gulp.task('build', ['at-build', 'templates', 'copy-assets']);
gulp.task('develop', ['build', 'server', 'watch', 'karma-ci']);
{'fraction_non_alphanumeric': 0.21777067715374215, 'fraction_numerical': 0.0012289541600098315, 'mean_word_length': 3.0997481108312344, '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': '558498', 'n_tokens_mistral': 2790, 'n_tokens_neox': 2729, 'n_words': 469}