yahoo/kobold

View on GitHub

Showing 17 of 17 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                this._it('should load the approved screen', function (done) {
                    this.getSource().getCurrentApprovedScreen(comparisonName).then(function (screen) {
                        this.approvedScreen = screen;
                        done();
                    }.bind(this), function (err) {
Severity: Major
Found in lib/kobold.js and 1 other location - About 3 hrs to fix
lib/kobold.js on lines 313..320

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 97.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                this._it('should load the build screen', function (done) {
                    this.getDestination().getBuildScreen(comparisonName).then(function (screen) {
                        this.buildScreen = screen;
                        done();
                    }.bind(this), function (err) {
Severity: Major
Found in lib/kobold.js and 1 other location - About 3 hrs to fix
lib/kobold.js on lines 304..311

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 97.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        _runAdditionsTests: function (additions) {
            var i, len;

            this._logger.debug("Run additions tests", additions);
            for (i = 0, len = additions.length; i < len; i++) {
Severity: Major
Found in lib/kobold.js and 2 other locations - About 2 hrs to fix
lib/kobold.js on lines 201..208
lib/kobold.js on lines 282..290

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 84.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        _runOrphanTests: function (orphans) {
            var i, len;

            this._logger.debug("Run orphans tests", orphans);
            for (i = 0, len = orphans.length; i < len; i++) {
Severity: Major
Found in lib/kobold.js and 2 other locations - About 2 hrs to fix
lib/kobold.js on lines 241..248
lib/kobold.js on lines 282..290

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 84.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        _runComparisonTests: function (comparisons) {

            var i, len;

            this._logger.debug("Run comparison tests", comparisons);
Severity: Major
Found in lib/kobold.js and 2 other locations - About 2 hrs to fix
lib/kobold.js on lines 201..208
lib/kobold.js on lines 241..248

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 84.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                for (buildIndex = 0, buildLength = buildScreens.length; buildIndex < buildLength; buildIndex++) {
                    if (approvedScreens[approvedIndex] === buildScreens[buildIndex]) {
                        found = true;
                        break;
                    }
Severity: Major
Found in lib/kobold.js and 1 other location - About 1 hr to fix
lib/kobold.js on lines 144..149

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 59.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                for (approvedIndex = 0, approvedLength = approvedScreens.length; approvedIndex < approvedLength; approvedIndex++) {
                    if (approvedScreens[approvedIndex] === buildScreens[buildIndex]) {
                        found = true;
                        break;
                    }
Severity: Major
Found in lib/kobold.js and 1 other location - About 1 hr to fix
lib/kobold.js on lines 125..130

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 59.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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