grunt-plato icon indicating copy to clipboard operation
grunt-plato copied to clipboard

Generated HTML reports reports functions with cyclomatic complexity 1 even if `maxcyc` is set to 8

Open mocheng opened this issue 10 years ago • 3 comments

The config in my Gruntfile is as below:

    plato: {
            options: {
                // Task-specific options go here.
            },
            your_target: {
                // Target-specific file lists and/or options go here.
                options: {
                    jshint: false, //leave jshint to grunt-jshint

                    // ref: https  : //github.com/philbooth/complexity-report
                    complexity : {
                        maxcyc     : 5,
                        maxcycden  : 100,
                        maxhd      : 100,
                        maxhv      : 100,
                        maxhe      : 100,
                        logicalor  : false,
                        switchcase : false,
                        forin      : true,
                        trycatch   : true,
                        newmi      : true
                    },

                    exclude: /\.min\.js$/    // excludes source files finishing with ".min.js"
                },
                files: {
                    'coverage/report/': coverage_code
                }
            }
        },

But, the generated report still highlight functions with cyclomatic complexity 1.

image

Is there way to limit the report to only highlight functions exceeding thresholds?

mocheng avatar Jan 15 '15 10:01 mocheng

No, it should highlight all functions by default with a rundown of stats.

jsoverson avatar Jan 15 '15 18:01 jsoverson

@jsoverson if there is no filtering, what is the maxcyc argument for?

mocheng avatar Jan 16 '15 14:01 mocheng

That's a feature of the consumed library, not necessarily something that plato takes advantage of.

jsoverson avatar Jan 16 '15 17:01 jsoverson