|
|
|
@ -1,14 +1,13 @@ |
|
|
|
|
'use strict' |
|
|
|
|
var AstWalker = require('remix-lib').AstWalker |
|
|
|
|
var list = require('./modules/list') |
|
|
|
|
const AstWalker = require('remix-lib').AstWalker |
|
|
|
|
const list = require('./modules/list') |
|
|
|
|
|
|
|
|
|
function staticAnalysisRunner () { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
staticAnalysisRunner.prototype.run = function (compilationResult, toRun, callback) { |
|
|
|
|
var self = this |
|
|
|
|
var modules = toRun.map(function (i) { |
|
|
|
|
var m = self.modules()[i] |
|
|
|
|
const modules = toRun.map((i) => { |
|
|
|
|
const m = this.modules()[i] |
|
|
|
|
return { 'name': m.name, 'mod': new m.Module() } |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
@ -16,12 +15,12 @@ staticAnalysisRunner.prototype.run = function (compilationResult, toRun, callbac |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
staticAnalysisRunner.prototype.runWithModuleList = function (compilationResult, modules, callback) { |
|
|
|
|
var reports = [] |
|
|
|
|
let reports = [] |
|
|
|
|
// Also provide convenience analysis via the AST walker.
|
|
|
|
|
var walker = new AstWalker() |
|
|
|
|
for (var k in compilationResult.sources) { |
|
|
|
|
walker.walk(compilationResult.sources[k].legacyAST, {'*': function (node) { |
|
|
|
|
modules.map(function (item, i) { |
|
|
|
|
const walker = new AstWalker() |
|
|
|
|
for (let k in compilationResult.sources) { |
|
|
|
|
walker.walk(compilationResult.sources[k].legacyAST, {'*': (node) => { |
|
|
|
|
modules.map((item, i) => { |
|
|
|
|
if (item.mod.visit !== undefined) { |
|
|
|
|
try { |
|
|
|
|
item.mod.visit(node) |
|
|
|
@ -38,8 +37,8 @@ staticAnalysisRunner.prototype.runWithModuleList = function (compilationResult, |
|
|
|
|
|
|
|
|
|
// Here, modules can just collect the results from the AST walk,
|
|
|
|
|
// but also perform new analysis.
|
|
|
|
|
reports = reports.concat(modules.map(function (item, i) { |
|
|
|
|
var report = null |
|
|
|
|
reports = reports.concat(modules.map((item, i) => { |
|
|
|
|
let report = null |
|
|
|
|
try { |
|
|
|
|
report = item.mod.report(compilationResult) |
|
|
|
|
} catch (e) { |
|
|
|
|