Code coverage report for lib/tasks/jslint.js

Statements: 90% (9 / 10)      Branches: 50% (3 / 6)      Functions: 100% (1 / 1)      Lines: 90% (9 / 10)     

All files » lib/tasks/ » jslint.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25          1   1 17 17     17   17     17 17       17    
/*
 * Copyright (c) 2011-2012, Yahoo! Inc.  All rights reserved.
 * Copyrights licensed under the New BSD License.
 * See the accompanying LICENSE file for terms.
 */
var linter = require('jslint/lib/linter');
 
exports.task = function (resource, options, done) {
    'use strict';
    var error,
        result;
 
    options = options || {};
 
    options.browser = true;
 
    // Make YUI global
    result = linter.lint("/*globals YUI */\n" + resource.content, options || {});
    Iif (result.errors.length > 0) {
        error = "Line " + result.errors[0].line + ", character " + result.errors[0].character + ": " + result.errors[0].reason;
    }
 
    done(error);
};