<commit_before>/**
 * grunt-npm-validate
 * https://github.com/joshuaspence/grunt-npm-validate
 *
 * Copyright (c) 2014 <NAME>
 * Licensed under the MIT license.
 */
module.exports = function(grunt) {
    'use strict';

    var chalk = require('chalk'),
        PJV = require('package-json-validator').PJV;

    grunt.registerTask('npm-validate', 'Opinionated package.json validator.', function() {
        var options = this.options({
            file: grunt.config('pkgFile') || 'package.json',
            force: false,
            strict: false
        });

        grunt.log.write('Validating ' + options.file + '...');

        var results = PJV.validate(grunt.file.read(options.file));
        var fail = results.errors || options.strict && results.warnings;

        if (fail) {
            grunt.log.error();
        } else {
            grunt.log.ok();
        }

        if ((results.errors || []).length) {
            grunt.log.subhead(chalk.bold(chalk.red('Errors:')));
            results.errors.forEach(function(error) {
                grunt.log.error(error);
            });
        }

        if ((results.warnings || []).length) {
            grunt.log.subhead(chalk.bold(chalk.yellow('Warnings:')));
            results.warnings.forEach(function(warning) {
                grunt.log.warn(warning);
            });
        }

        if ((results.recommendations || []).length) {
            grunt.log.subhead(chalk.bold(chalk.green('Recommendations:')));
            results.recommendations.forEach(function(recommendation) {
                grunt.log.warn(recommendation);
            });
        }

        return options.force || !fail;
    });
};<commit_msg>Don't need to use `chalk.bold` because `grunt.log.subhead` does the same thing.<commit_after>/**
 * grunt-npm-validate
 * https://github.com/joshuaspence/grunt-npm-validate
 *
 * Copyright (c) 2014 <NAME>
 * Licensed under the MIT license.
 */
module.exports = function(grunt) {
    'use strict';

    var chalk = require('chalk'),
        PJV = require('package-json-validator').PJV;

    grunt.registerTask('npm-validate', 'Opinionated package.json validator.', function() {
        var options = this.options({
            file: grunt.config('pkgFile') || 'package.json',
            force: false,
            strict: false
        });

        grunt.log.write('Validating ' + options.file + '...');

        var results = PJV.validate(grunt.file.read(options.file));
        var fail = results.errors || options.strict && results.warnings;

        if (fail) {
            grunt.log.error();
        } else {
            grunt.log.ok();
        }

        if ((results.errors || []).length) {
            grunt.log.subhead(chalk.red('Errors:'));
            results.errors.forEach(function(error) {
                grunt.log.error(error);
            });
        }

        if ((results.warnings || []).length) {
            grunt.log.subhead(chalk.yellow('Warnings:'));
            results.warnings.forEach(function(warning) {
                grunt.log.warn(warning);
            });
        }

        if ((results.recommendations || []).length) {
            grunt.log.subhead(chalk.green('Recommendations:'));
            results.recommendations.forEach(function(recommendation) {
                grunt.log.warn(recommendation);
            });
        }

        return options.force || !fail;
    });
};
{'fraction_non_alphanumeric': 0.15724381625441697, 'fraction_numerical': 0.002355712603062426, 'mean_word_length': 1.9955908289241622, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '474764', 'n_tokens_mistral': 1041, 'n_tokens_neox': 992, 'n_words': 154}