yahoo/blink-diff

View on GitHub

Showing 40 of 88 total issues

File index.js has 507 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

var assert = require('assert'),
    PNGImage = require('pngjs-image'),
Severity: Major
Found in index.js - About 1 day to fix

Function exports has 124 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function () {

    function versionInfo () {
        return {
            major: 1,
Severity: Major
Found in lib/scripts/structure.js - About 4 hrs to fix

Function generate has 119 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        generate: function () {

            var options = this._options,
                blockOuts,
                comparison,
Severity: Major
Found in lib/compatibility.js - About 4 hrs to fix

Function exports has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function () {

    function versionInfo () {
        return {
            major: 1,
Severity: Minor
Found in lib/scripts/structure.js - About 4 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 run has 95 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    run: function (fn) {

        var promise = Promise.resolve(), result;

        PNGImage.log = function (text) {
Severity: Major
Found in index.js - About 3 hrs to fix

Function runSync has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    runSync: function () {

        var result, gamma, i, len, rect, color;

        PNGImage.log = function (text) {
Severity: Major
Found in index.js - About 3 hrs to fix

Function process has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        process: function () {

            // Catch all image errors
            PNGImage.log = function (text) {
                this.log('ERROR: ' + text);
Severity: Major
Found in index2.js - About 3 hrs to fix

Function compare has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

        compare: function (comparison, flagField) {

            var flagFieldIndexA, dataIndexA,
                flagFieldIndexB, dataIndexB,
                x, y, delta,
Severity: Minor
Found in lib/pixelComparator.js - About 3 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

prototype has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

BlinkDiff.prototype = {

    /**
     * Runs the comparison with a promise
     *
Severity: Minor
Found in index.js - About 2 hrs to fix

Function BlinkDiff has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function BlinkDiff (options) {

    this._imageA = options.imageA;
    this._imageAPath = options.imageAPath;
    assert.ok(options.imageAPath || options.imageA, "Image A not given.");
Severity: Major
Found in index.js - About 2 hrs to fix

Function runSync has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    runSync: function () {

        var result, gamma, i, len, rect, color;

        PNGImage.log = function (text) {
Severity: Minor
Found in index.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

Output has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

    {
        /**
         * Gets the path of the output image
         *
         * @method getImagePath
Severity: Minor
Found in lib/configuration/output.js - About 2 hrs to fix

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

        process: function () {

            // Catch all image errors
            PNGImage.log = function (text) {
                this.log('ERROR: ' + text);
Severity: Minor
Found in index2.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 _shiftCompare has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

        _shiftCompare: function (x, y, colorIndex, comparison, imageSrc, areaSrc, imageDst, areaDst) {

            var xOffset, xLow, xHigh,
                yOffset, yLow, yHigh,

Severity: Minor
Found in lib/pixelComparator.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

Config has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

    {
        /**
         * Is in debug-mode?
         *
         * @method isDebugMode
Severity: Minor
Found in lib/configuration/config.js - About 2 hrs to fix

Function _shiftCompare has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    _shiftCompare: function (x, y, color, deltaThreshold, imageA, imageB, width, height, hShift, vShift, perceptual, gamma) {

        var i, xOffset, xLow, xHigh, yOffset, yLow, yHigh, delta, color1, color2, localDeltaThreshold;

        if ((hShift > 0) || (vShift > 0)) {
Severity: Minor
Found in index.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 domInfo has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function domInfo () {

        var capturedTags = ["A", "SPAN", "OL", "UL", "LI", "HEADER", "FOOTER", "NAV", "ARTICLE", "SECTION", "ASIDE", "DIV", "APPLET", "CANVAS", "VIDEO", "TABLE", "DETAILS", "SUMMARY", "IFRAME", "MENU", "MAIN", "FIGURE", "FIELDSET"];

        function loadDOMNode (inputNode, parentNode) {
Severity: Minor
Found in lib/scripts/structure.js - About 1 hr to fix

Function _pixelCompare has 13 arguments (exceeds 4 allowed). Consider refactoring.
Open

    _pixelCompare: function (imageA, imageB, imageOutput, deltaThreshold, width, height, outputMaskColor, outputShiftColor, backgroundColor, hShift, vShift, perceptual, gamma) {
Severity: Major
Found in index.js - About 1 hr to fix

Function _shiftCompare has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

    _shiftCompare: function (x, y, color, deltaThreshold, imageA, imageB, width, height, hShift, vShift, perceptual, gamma) {
Severity: Major
Found in index.js - About 1 hr to fix

Function _pixelCompare has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    _pixelCompare: function (imageA, imageB, imageOutput, deltaThreshold, width, height, outputMaskColor, outputShiftColor, backgroundColor, hShift, vShift, perceptual, gamma) {
        var difference = 0, i, x, y, delta, color1, color2;

        for (x = 0; x < width; x++) {
            for (y = 0; y < height; y++) {
Severity: Minor
Found in index.js - About 1 hr 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