Code coverage report for lib/util/jshint-adapter.js

Statements: 100% (10 / 10)      Branches: 100% (2 / 2)      Functions: 75% (3 / 4)      Lines: 100% (10 / 10)      Ignored: none     

All files » lib/util/ » jshint-adapter.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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56          1                 1   1 1                               1   2             2 1         2           1  
'use strict';
 
/**
 * @constructor
 */
var JshintAdapter = function()
{
};
 
/**
 * @param {File} file
 * @return {Function}
 * @private
 */
JshintAdapter.createErrorParser_ = function(file)
{
  return function(error) {
    return {
      file: file.relative,
      error: {
        code: 'Warning',
        reason: error.description,
        line: error.line,
        character: '[unknown]'
      }
    };
  };
};
 
/**
 * @param {File} file
 * @return {File}
 */
JshintAdapter.parseFile = function(file)
{
  file.jshint = {
    success: file.gjslint.success,
    results: [],
    data: [],
    options: {}
  };
 
  if (!file.jshint.success) {
    file.jshint.results = file.gjslint.results.errors.map(
      JshintAdapter.createErrorParser_(file)
    );
  }
 
  return file;
};
 
/**
 * @type {JshintAdapter}
 */
module.exports = JshintAdapter;