/** * Start Plato inspector and visualizer * @param {Function} done - callback when complete */ function startPlatoVisualizer(done) { log('Running Plato'); var files = glob.sync(config.plato.js); var excludeFiles = /.*\.spec\.js/; var plato = require('plato'); var options = { title: 'Plato Inspections Report', exclude: excludeFiles }; var outputDir = config.report + '/plato'; plato.inspect(files, outputDir, options, platoCompleted); function platoCompleted(report) { var overview = plato.getOverviewReport(report); if (args.verbose) { log(overview.summary); } if (done) { done(); } } }
/** * Start Plato inspector and visualizer */ function startPlatoVisualizer(done) { utils.log('Running Plato'); var files = glob.sync(config.files); var excludeFiles = config.exclude; var jsHintRc = JSON.parse(require('fs').readFileSync(require.resolve('../../.jshintrc'), 'utf8')); var options = { title: config.title, exclude: excludeFiles, jshint: { options: _.omit(jsHintRc, 'globals'), globals: jsHintRc.globals } }; plato.inspect(files, config.output, options, platoCompleted); function platoCompleted(report) { var overview = plato.getOverviewReport(report); if (args.verbose) { utils.log(overview.summary); } if (done) { done(); } } }
gulp.task('plato', function () { var files = ['src/**/*.js'] var outputDir = 'build/plato' var callback = function (report) { /* once done the analysis,execute this */ } plato.inspect(files, outputDir, {}, callback) })
gulp.task('complexity', function (done) { function callback () { done() } plato.inspect(paths.lint, 'build/complexity', {title: 'prerender', recurse: true}, callback) })
gulp.task('plato', (cb) => { const plato = require('plato') $.build.dir = $.reports.plato.dir $.config.port = $.reports.plato.port plato.inspect($.reports.plato.files, $.reports.plato.dir, {}, () => cb()) })
return function(file) { var deferred = Q.defer(); plato.inspect(file, options.tmp + '/plato', {}, function(report) { deferred.resolve(report); }); return deferred.promise; };
Utils.startPlatoVisualizer = function() { log('Running Plato'); plato.inspect( glob.sync('./src/client/app/**/*.js') // files , './report/plato' // output directory , { title : 'Plato Inspections Report' , exclude:/\/src\/client\/app\/.*\.spec\.js/ } // options , function(report) { // callback on success log(plato.getOverviewReport(report).summary); } ); };
}, function (cb) { if (paths.length === 0) { return cb(); } plato.inspect(paths, destDir, options, function () { gutil.log('gulp-plato: Report generated in ' + gutil.colors.blue(destDir) + '.'); cb(); }); });
$.gulp.task('plato', (cb) => { const plato = require('plato') const FILES = [ `${$.deploy.js}/**/*.js` ] const OPTIONS = {} $.config.port = 8003 $.deploy.dir = './_analysis/plato' plato.inspect(FILES, $.plato, OPTIONS, () => $.runSequence('webserver')) })
grunt.registerMultiTask('plato', 'Generate static analysis charts with plato', function() { var options = this.options({ jshint: {}, jshintrc: '', complexity: { newmi : true } }); if (options.jshintrc) { options.jshint = grunt.file.readJSON(grunt.config.process(options.jshintrc)); } if (options.jshint && !options.jshint.options) { options.jshint = { options : options.jshint, globals : options.jshint.globals || {} }; delete options.jshint.options.globals; } if (options.excludeFromFile) { options.exclude = (function() { var ignore = grunt.file.read(options.excludeFromFile), files = ignore.split('\n'), regex = '', file; for (var i = 0, n = files.length; i < n; i++) { file = files[i]; if (file.length > 0) { file = file.replace('/', '\\/').replace('.', '\\.').replace('*', '\\*'); regex += file + '|'; } } regex = regex.substr(0, regex.length - 1); return new RegExp(regex); })(); } var done = this.async(); plato.inspect(this.filesSrc, this.files[0].dest, options, function(){ done(); }); });
/** * Start Plato inspector and visualizer */ function startPlatoVisualizer() { log('Running Plato'); var files = glob.sync('toastr.js'); var options = { title: 'Plato Inspections Report' }; var outputDir = './report/plato'; plato.inspect(files, outputDir, options, platoCompleted); function platoCompleted(report) { var overview = plato.getOverviewReport(report); log(overview.summary); } }
/** * Start Plato inspector and visualizer */ function startPlatoVisualizer() { log('Running Plato'); var files = glob.sync('./html/**/*.js'); var excludeFiles = /\/src\/client\/app\/.*\.spec\.js/; var options = { title: 'Plato Inspections Report', exclude: excludeFiles }; var outputDir = './report/plato'; plato.inspect(files, outputDir, options, platoCompleted); function platoCompleted(report) { var overview = plato.getOverviewReport(report); log(overview.summary); } }
/** * Starts Plato Visualizer so it analyzes the code and wraps the analysis in a report. * @param {function} done callback fucntion. */ function startPlatoVisualizer(done) { var plato = require('plato'); var files = glob.sync(config.paths.js.dev); var outputDir = config.plato.dest; function platoCompleted(report) { var overview = plato.getOverviewReport(report); if (args.verbose) { utils.log(overview.summary); } utils.log('Your report is available at: file://' + global.BASE_DIR + outputDir.slice(1) + '/index.html'); if (done) { done(); } } plato.inspect(files, outputDir, config.plato.options, platoCompleted); }
gulp.task('plato', function(done) { gulp.log('Analyzing source with Plato'); gulp.log('Browse to ' + config.dest + '/index.html to see Plato results'); /* Inspect our code */ plato.inspect(glob(config.src), config.dest, config.options, platoCallback); /** * @param {Object} report * @return {void} */ function platoCallback(report) { if (config.verbose) { gulp.log(plato.getOverviewReport(report).summary); } if (done) { done(); } } });
function generateReport(done) { var files = [ config.build + '**/*.js', '!' + config.build + '**/*.test.js', '!' + config.build + '**/*.spec.js' ]; var outputDir = './plato/dir'; var options = { title: 'OrderCloud Code Analysis' }; var callback = function(report) { plato.getOverviewReport(report); if (done) { done(); } }; plato.inspect(files, outputDir, options, callback); }
function platoHandler() { var plato = require('plato'); var title = getTitle(projectPath); var files = []; var cb = function callback(abspath, rootdir, subdir, filename) { files.push(abspath); }; grunt.file.recurse(projectPath + '/' + sourceDirectory, cb); var outputDir = projectPath + '/doc/plato'; var options = { title: title, recurse: true, date: new Date().getTime() }; var file = ''; var task = 'jsdoc'; var message = '' var callback = function (report) { // NOTE: report is all the JSON data //console.log('runPlato DONE', report); resolve(0); console.log = saveLog; }; console.log = function (a, b) { // saveLog('runPlato ERROR'); //saveLog('0', a); //saveLog('1', b); //saveLog('END runPlato ERROR'); // if (b) { file = b; } else { message = a; grunt.addToDoItem(file, task, message); } }; plato.inspect(files, outputDir, options, callback); }
var _plato = function(done) { var files = glob.sync(config.js.src); var excludeFiles = /.*-spec\.js/; var plato = require('plato'); var options = { title: 'Code Complexity Report', exclude: excludeFiles }; var outputDir = config.js.reportsDir + '/complexity'; plato.inspect(files, outputDir, options, function platoCompleted(report) { var overview = plato.getOverviewReport(report); if(config.args.verbose) { console.log(overview.summary); } if(done) { done(); } }); };
/** * 用Plato开始观察, 生成报告 */ function startPlatoVisualizer (done) { config.log('运行Plato'); var files = glob.sync(config.plato.js); // 拿到匹配文件 var excludeFiles = /.*\.spec\.js/; // 排除的文件 var plato = require('plato'); var options = { title: 'Plato 检查报告', exclude: excludeFiles }; var outputDir = config.report + '/plato'; plato.inspect(files, outputDir, options, platoCompleted); // 开始检查 // 完成后回调 function platoCompleted (report) { var overview = plato.getOverviewReport(report); // 概要 if (args.verbose) { config.log(overview.summary); } if (done) { done(); } } }
grunt.registerMultiTask('plato', 'Generate static analysis charts with plato', function() { var options = this.options({ jshint: {}, complexity: { newmi : true } }); if (options.jshint && !options.jshint.options) { options.jshint = { options : options.jshint, globals : options.jshint.globals || {} }; delete options.jshint.options.globals; } var done = this.async(); plato.inspect(this.filesSrc, this.files[0].dest, options, function(){ done(); }); });
function complexity() { var defaultJsHintOpts = { strict: true, curly: true, unused: true, undef: true, node: true }, complexityArgs = { trycatch: true, newmi: true }, platoArgs = { jshint: jsHintArgs || defaultJsHintOpts, complexity: complexityArgs }; function callback() { } return plato.inspect(src, 'artifacts/complexity', platoArgs, callback); }
function startPlatoVisualizer(done) { log('Running Plato'); var files = ['src/app/**/*.js']; var excludeFiles = /.*\_test\.js/; var plato = require('plato'); var options = { title: 'Plato Inspections Report', jshint: '.jshintrc', exclude: excludeFiles }; var outputDir = 'report'; plato.inspect(files, outputDir, options, platoCompleted); function platoCompleted(report) { var overview = plato.getOverviewReport(report); log(overview.summary); if (done) { done(); } } }
function run() { plato.inspect('tmp/plato', files.dest.plato, options,() => {}); }
action(done) { plato.inspect(this._buildManager.options.scripts, "analysis/", { recurse: true }, _.ary(done, 0)); }
gulp.task('doc', function(){ plato.inspect(files, outputDir, {}, callback); gulp.src(["./lib/*.js", "./ext/*.js"]) .pipe(jsdoc('./doc')) })
gulp.task('code-report', function () { return plato.inspect('./lib/**/*.js', './report', {}, () => [ exec('echo The code report has been generated. See report directory for details.') ]); });
gulp.task('lint', ['clean', 'eslint','lint-less' ], function() { return plato.inspect(conf.js, conf.report, {title: 'CDP-lint report'}, function() { console.log('Report created'); }); });
gulp.task('plato', function () { return plato.inspect(conf.js, conf.report, {}, function () { console.log("Report was built"); }); });
var plato = require('plato'); var config = require('./gulp/config')(); var files = config.alljs; var outputDir = config.scripts.plato; var options = { title: 'gulp demo' }; var callback = function (report) { // console.log(report); }; plato.inspect(files, outputDir, options, callback);