<commit_before>/*eslint-env node*/

'use strict';

var path = require('path');

var browserify = require('browserify');
var eventStream = require('event-stream');
var glob = require('glob');
var gulp = require('gulp');
var mainBowerFiles = require('main-bower-files');
var rimraf = require('rimraf');
var source = require('vinyl-source-stream');

var plugins = require('gulp-load-plugins')();

var args = require('yargs').argv;

var paths = {
  js: ['./static/js/**.js', './**/static/js/**.js'],
  jsEntries: ['./static/js/*.js', './**/static/js/*.js'],
  sass: './static/sass/**.scss',
  python: '**/*.py',
  bootstrapDetritus: [
    './static/vendor/bootstrap/dist/css/bootstrap.css.map',
    './static/vendor/bootstrap/dist/css/bootstrap-theme.css.map'
  ]
};

// Clean up files
gulp.task('clean', function (cb) {
  rimraf('./build', cb);
});

// Lint JavaScript code
gulp.task('lint-js', function () {
  return gulp.src(paths.js)
    .pipe(plugins.eslint())
    .pipe(plugins.eslint.format());
});

// Lint Python code
gulp.task('lint-python', function () {
  return gulp.src(paths.python)
    .pipe(plugins.shell([
      'flake8 <%= file.path %>',
      'pylint --reports=no <%= file.path %>'
    ]));
});

gulp.task('lint', ['lint-js', 'lint-python']);

// Ensure bower components are installed
gulp.task('bower-install', function () {
  return plugins.bower();
});

// Collect the main files of the installed bower components
gulp.task('bower-main-files', ['bower-install'], function () {
  return gulp.src(mainBowerFiles())
    .pipe(gulp.dest('./build/vendor'));
});

// Collect any additional files we might need<commit_msg>👕 improve python/js linting<commit_after>/*eslint-env node*/

'use strict';

var browserify = require('browserify');
var eventStream = require('event-stream');
var glob = require('glob');
var gulp = require('gulp');
var mainBowerFiles = require('main-bower-files');
var path = require('path');
var rimraf = require('rimraf');
var source = require('vinyl-source-stream');

var plugins = require('gulp-load-plugins')();

var args = require('yargs').argv;

var paths = {
  js: ['./static/js/**.js', './**/static/js/**.js'],
  jsEntries: ['./static/js/*.js', './**/static/js/*.js'],
  sass: './static/sass/**.scss',
  python: ['**/*.py', '!**/migrations/*.py', '!./node_modules/**/*.py'],
  bootstrapDetritus: [
    './static/vendor/bootstrap/dist/css/bootstrap.css.map',
    './static/vendor/bootstrap/dist/css/bootstrap-theme.css.map'
  ]
};

// Clean up files
gulp.task('clean', function (cb) {
  rimraf('./build', cb);
});

// Lint JavaScript code
gulp.task('lint-js', function () {
  return gulp.src(paths.js)
    .pipe(plugins.eslint({
      useEslintrc: true,
      rulesPaths: [
        path.join(process.env.HOME, '.eslint')
      ]
    }))
    .pipe(plugins.eslint.format());
});

// Lint Python code
gulp.task('lint-python', function () {
  var shellOptions = {ignoreErrors: true};

  return gulp.src(paths.python)
    .pipe(plugins.shell([
      'flake8 <%= file.path %> | awk \'$0="flake8: "$0\''
    ], shellOptions))
    .pipe(plugins.shell([
      'pylint --rcfile=.pylintrc -r no -f colorized <%= file.path %> |' +
      ' awk \'$0="pylint: "$0\''
    ], shellOptions))
    .pipe(plugins.shell([
      'pep257 <%= file.path %> 2>&1 | awk \'$0="pep257: "$0\''
    ], shellOptions));
});

gulp.task('lint', ['lint-js', 'lint-python']);

// Ensure bower components are installed
gulp.task('bower-install', function () {
  return plugins.bower();
});

// Collect the main files of the installed bower components
gulp.task('bower-main-files', ['bower-install'], function () {
  return gulp.src(mainBowerFiles())
    .pipe(gulp.dest('./build/vendor'));
});

// Collect any additional files we might need
{'fraction_non_alphanumeric': 0.2206196581196581, 'fraction_numerical': 0.004540598290598291, 'mean_word_length': 3.63490099009901, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 9, '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': '1138993', 'n_tokens_mistral': 1311, 'n_tokens_neox': 1297, 'n_words': 260}