yahoo/kobold

View on GitHub

Showing 10 of 17 total issues

Function filterArguments has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

function filterArguments(args, params, inject) {

    var newArgs = ['node', '_mocha'].concat(inject || []),
        param, i, len,
        type;
Severity: Minor
Found in lib/cli.js - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function _runComparisonTest has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        _runComparisonTest: function (comparisonName) {

            this._logger.debug("Run comparison tests", comparisonName);
            this._describe(this._getTestName(comparisonName), function () {

Severity: Major
Found in lib/kobold.js - About 2 hrs to fix

Function _determineScreensState has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

        _determineScreensState: function (screens) {

            var buildScreens = screens[0],
                approvedScreens = screens[1],

Severity: Minor
Found in lib/kobold.js - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File kobold.js has 259 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright 2014, Yahoo! Inc.
// Copyrights licensed under the Mit License. See the accompanying LICENSE file for terms.

var utils = require('preceptor-core').utils;
var Base = require('preceptor-core').Base;
Severity: Minor
Found in lib/kobold.js - About 2 hrs to fix

Function prepareEnvironment has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function prepareEnvironment (argv) {

    var params, args;

    // Define default values
Severity: Minor
Found in lib/cli.js - About 1 hr to fix

Function _determineScreensState has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        _determineScreensState: function (screens) {

            var buildScreens = screens[0],
                approvedScreens = screens[1],

Severity: Minor
Found in lib/kobold.js - About 1 hr to fix

Function filterArguments has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function filterArguments(args, params, inject) {

    var newArgs = ['node', '_mocha'].concat(inject || []),
        param, i, len,
        type;
Severity: Minor
Found in lib/cli.js - About 1 hr to fix

Avoid deeply nested control flow statements.
Open

                    if (type === 'number') {
                        params[param] = parseFloat(params[param]);
                    }
Severity: Major
Found in lib/cli.js - About 45 mins to fix

Function _archiveTest has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        _archiveTest: function (passed, testName, approvedImage, buildImage, highlightImage) {
Severity: Minor
Found in lib/kobold.js - About 35 mins to fix

Function _archiveTest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        _archiveTest: function (passed, testName, approvedImage, buildImage, highlightImage) {

            var archiveList = [];

            this._logger.debug("Archive test", testName);
Severity: Minor
Found in lib/kobold.js - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language