<commit_before>'use strict';

var through = require('through2');
var utils = require('../lib/utils');
var logger = require('../lib/logging');

module.exports = function dotfilesPlugin() {
  return through.obj(function (file, enc, cb) {
    if (file.isNull() || !file.isBuffer()) {
      this.push(file);
      return cb();
    }

    var str = file.contents.toString();
    var log = logger(str);

    if (utils.contains(file, '.gitattributes')) {
      str = [
        '# Enforce Unix newlines',
        '*.* text eol=lf',
        '',
        '# binaries',
        '*.jpg binary',
        '*.gif binary',
        '*.png binary',
        '*.jpeg binary'
      ].join('\n');
      log.success(str, 'updated patterns in', file.relative);
    }

    file.contents = new Buffer(str);
    this.push(file);
    cb();
  });
};
<commit_msg>adds binaries<commit_after>'use strict';

var through = require('through2');
var utils = require('../lib/utils');
var logger = require('../lib/logging');

module.exports = function dotfilesPlugin() {
  return through.obj(function (file, enc, cb) {
    if (file.isNull() || !file.isBuffer()) {
      this.push(file);
      return cb();
    }

    if (utils.contains(file, '.gitattributes')) {
      var str = file.contents.toString();
      var log = logger(str);

      str = [
        '# Enforce Unix newlines',
        '* text eol=lf',
        '',
        '# binaries',
        '*.ai binary',
        '*.psd binary',
        '*.jpg binary',
        '*.gif binary',
        '*.png binary',
        '*.jpeg binary'
      ].join('\n');

      log.success(str, 'updated patterns in', file.relative);
      file.contents = new Buffer(str);
    }

    this.push(file);
    cb();
  });
};

{'fraction_non_alphanumeric': 0.1888111888111888, 'fraction_numerical': 0.0011655011655011655, 'mean_word_length': 2.2518939393939394, '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': '3581833', 'n_tokens_mistral': 545, 'n_tokens_neox': 537, 'n_words': 125}