runner.js
/**
 * Linter driver logic: spawn a child process, gather the results and build
 * a report
 * @param {*} linter A linter instance
 * @param {string} workingDirectory The path to the process working directory
 * @param {string[]} files Files to analyze
 * @returns {Promise<any>} A promise for the report object with the analysis results
 */
Linter driver logic: spawn a child process, gather the results and build
a report
@param {*} linter A linter instance
@param {string} workingDirectory The path to the process working directory
@param {string[]} files Files to analyze
@returns {Promise} A promise for the report object with the analysis results
Linter driver logic : spawn a child process gather the results and build a report @param { * } linter A linter instance @param { string } workingDirectory The path to the process working directory @param { string [] } files Files to analyze @returns { Promise } A promise for the report object with the analysis results
function run (linter, workingDirectory, files) {
  const filtered = linter.filter(files)
  if (filtered.length === 0) { return linter.defaultReport }
  const reportFilePath = path.join(workingDirectory, '..', linter.reportFile)
  const process = spawn(linter.name, linter.args(filtered, path.join('..', linter.reportFile)), { cwd: workingDirectory })
  let errorLogs = ''
  process.stderr.on('data', (chunk) => {
    errorLogs += chunk.toString()
  })
  return new Promise((resolve, reject) => {
    process.on('error', reject)
    process.on('close', () => reportHandler(linter, path.resolve(workingDirectory), reportFilePath, resolve, reject, errorLogs))
  })
}
function run ( linter , workingDirectory , files ) { const filtered = linter . filter ( files ) if ( filtered . length === 0 ) { return linter . defaultReport } const reportFilePath = path . join ( workingDirectory , '..' , linter . reportFile ) const process = spawn ( linter . name , linter . args ( filtered , path . join ( '..' , linter . reportFile ) ) , { cwd : workingDirectory } ) let errorLogs = '' process . stderr . on ( 'data' , ( chunk ) => { errorLogs += chunk . toString ( ) } ) return new Promise ( ( resolve , reject ) => { process . on ( 'error' , reject ) process . on ( 'close' , ( ) => reportHandler ( linter , path . resolve ( workingDirectory ) , reportFilePath , resolve , reject , errorLogs ) ) } ) }
Linter driver logic: spawn a child process, gather the results and build
 a report
 @param {*} linter A linter instance
 @param {string} workingDirectory The path to the process working directory
 @param {string[]} files Files to analyze
 @returns {Promise<any>} A promise for the report object with the analysis results
Linter driver logic : spawn a child process gather the results and build a report @param { * } linter A linter instance @param { string } workingDirectory The path to the process working directory @param { string [] } files Files to analyze @returns { Promise<any > } A promise for the report object with the analysis results
// Promise report generation