<commit_before>/*eslint no-console: ["error", {allow: ["log"]}] */

var validate  = require('./index.js');
var colors    = require('colors/safe');
var cliff     = require('cliff');
var pluralize = require('pluralize');
var bytes     = require('bytes');
var fs        = require('fs');

module.exports = function (dir, options) {
    if (fs.existsSync(dir)) {
        validate.BIDS(dir, options, function (issues, summary) {
            var errors = issues.errors;
            var warnings = issues.warnings;
            if (issues === 'Invalid') {
                console.log(colors.red("The directory " + dir + " failed an initial Quick Test. This means the basic names and structure of the files and directories do not comply with BIDS specification. For more info go to http://bids.neuroimaging.io/"));
            } else if (issues.config && issues.config.length >= 1) {
                console.log(colors.red('Invalid Config File'));
                for (var i = 0; i < issues.config.length; i++) {
                    var issue = issues.config[i];
                    issue.file.file = {relativePath: issue.file.path};<commit_msg>Handle the 'Invalid' early exit as a special kind of error.<commit_after>/*eslint no-console: ["error", {allow: ["log"]}] */

var validate  = require('./index.js');
var colors    = require('colors/safe');
var cliff     = require('cliff');
var pluralize = require('pluralize');
var bytes     = require('bytes');
var fs        = require('fs');

module.exports = function (dir, options) {
    if (fs.existsSync(dir)) {
        validate.BIDS(dir, options, function (issues, summary) {
            var errors = issues.errors;
            var warnings = issues.warnings;
            if (issues.errors.length === 1 && issues.errors[0].code === 61) {
                console.log(colors.red("The directory " + dir + " failed an initial Quick Test. This means the basic names and structure of the files and directories do not comply with BIDS specification. For more info go to http://bids.neuroimaging.io/"));
            } else if (issues.config && issues.config.length >= 1) {
                console.log(colors.red('Invalid Config File'));
                for (var i = 0; i < issues.config.length; i++) {
                    var issue = issues.config[i];
                    issue.file.file = {relativePath: issue.file.path};
{'fraction_non_alphanumeric': 0.14188615123194562, 'fraction_numerical': 0.0033984706881903144, 'mean_word_length': 2.514925373134328, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3323270', 'n_tokens_mistral': 655, 'n_tokens_neox': 629, 'n_words': 203}