1
我想在目录中的所有文件上运行Grunt-Complexity? 我想获得this kind of output。 有没有办法? 我的js文件全部在名为“js”的子目录下。 这里是我的gruntfile:目录中所有文件的Grunt-complexity
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Task configuration.
complexity: {
generic: {
src: ['grunt.js', 'js/*'],
//exclude: ['doNotTest.js'],
options: {
breakOnErrors: false,
jsLintXML: 'report.xml', // create XML JSLint-like report
checkstyleXML: 'checkstyle.xml', // create checkstyle report
pmdXML: 'pmd.xml', // create pmd report
errorsOnly: false, // show only maintainability errors
cyclomatic: [3, 7, 12], // or optionally a single value, like 3
halstead: [8, 13, 20], // or optionally a single value, like 8
maintainability: 100,
hideComplexFunctions: false, // only display maintainability
broadcast: false // broadcast data over event-bus
}
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-complexity');
// Default task.
grunt.registerTask('default', 'complexity');
};
我只是调用这个由命令行中键入
grunt
。 那么如果我键入此
grunt complexity js/*
我得到
Warning: Task "js/AgencyMediaController.js" not found. Use --force to continue.
Aborted due to warnings.
而且AgencyMediaController.js是我的js目录中的第一个文件。所以它看看并列出文件,但它然后崩溃。
Thanx!
嗨拉杜肯,我试过这个,但我得到的是这样的: 运行“复杂性:通用”(复杂)任务 警告:无效的源使用--force继续。 由于警告而中止。 – Mig82
你可以分享你的完整gruntfile.js吗?谢谢。 – Raduken
这是我上面发布的内容。这就是全部。 – Mig82