1

ディレクトリ内のすべてのファイルに対してGrunt-Complexityを実行したいですか? この種の出力を取得したいと思います。方法はありますか?私のjsファイルはすべて「js」というサブディレクトリの下にあります。ここに私のうなり声があります:

/*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 ディレクトリの最初のファイルです。そのため、ファイルを見て一覧表示していますが、その後クラッシュします。

ありがとう!

4

2 に答える 2