tasks/lib/i18n_linter.js
function run(files, options) {
        // If translations or templates are not supplied then error
        if (options.translations.length === 0) {
            grunt.fail.fatal('Please supply translations');
        }

        // If a missing translation regex has been supplied report the missing count
        if (options.missingTranslationRegex !== null) {
            linter.setMissingTranslationRegex(options.missingTranslationRegex);
        }

        // Add the translation keys to the linter
        options.translations.forEach(function(file) {
            var files = grunt.file.expand(file);

            files.forEach(function(file) {
                if (!grunt.file.exists(file)) {
                    grunt.fail.fatal('File ' + file + ' does not exist');
                }
                linter.addKeys(grunt.file.readJSON(file));
            });
        });

        // Iterate through files and run them through the linter
        files.forEach(function(file) {
            if (!grunt.file.exists(file)) {
                grunt.fail.fatal('File ' + file + ' does not exist');
            }
            linter.check(grunt.file.read(file));
        });
    }
function run(files, options) {
        // If translations or templates are not supplied then error
        if (options.translations.length === 0) {
            grunt.fail.fatal('Please supply translations');
        }

        // If a missing translation regex has been supplied report the missing count
        if (options.missingTranslationRegex !== null) {
            linter.setMissingTranslationRegex(options.missingTranslationRegex);
        }

        // Add the translation keys to the linter
        options.translations.forEach(function(file) {
            var files = grunt.file.expand(file);

            files.forEach(function(file) {
                if (!grunt.file.exists(file)) {
                    grunt.fail.fatal('File ' + file + ' does not exist');
                }
                linter.addKeys(grunt.file.readJSON(file));
            });
        });

        // Iterate through files and run them through the linter
        files.forEach(function(file) {
            if (!grunt.file.exists(file)) {
                grunt.fail.fatal('File ' + file + ' does not exist');
            }
            linter.check(grunt.file.read(file));
        });
    }
function run ( files , options ) { // If translations or templates are not supplied then error if ( options . translations . length === 0 ) { grunt . fail . fatal ( 'Please supply translations' ) ; } // If a missing translation regex has been supplied report the missing count if ( options . missingTranslationRegex !== null ) { linter . setMissingTranslationRegex ( options . missingTranslationRegex ) ; } // Add the translation keys to the linter options . translations . forEach ( function ( file ) { var files = grunt . file . expand ( file ) ; files . forEach ( function ( file ) { if ( ! grunt . file . exists ( file ) ) { grunt . fail . fatal ( 'File ' + file + ' does not exist' ) ; } linter . addKeys ( grunt . file . readJSON ( file ) ) ; } ) ; } ) ; // Iterate through files and run them through the linter files . forEach ( function ( file ) { if ( ! grunt . file . exists ( file ) ) { grunt . fail . fatal ( 'File ' + file + ' does not exist' ) ; } linter . check ( grunt . file . read ( file ) ) ; } ) ; }
Run the linter against the given files and options
@param {Array} files List of files to check
@param {Object} options List of options
Run the linter against the given files and options