yahoo/blink-diff

View on GitHub

Showing 40 of 88 total issues

Function _compare has 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

Function findElementAt has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        findElementAt: function (x, y) {

            var nodes,
                result,
                i;
Severity: Minor
Found in lib/configuration/structure/domElement.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

Function generate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        generate: function () {

            var options = this._options,
                blockOuts,
                comparison,
Severity: Minor
Found in lib/compatibility.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

Function _shiftCompare has 31 lines of code (exceeds 25 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 1 hr to fix

Function convertToPerceptual has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        convertToPerceptual: function () {

            var i, len,
                data,
                pixelList,
Severity: Minor
Found in lib/image.js - About 1 hr to fix

Function _loadImage has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        _loadImage: function (blob) {

            var decoder,
                data,
                headerChunk,
Severity: Minor
Found in lib/configuration/image.js - About 1 hr to fix

Function compare has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        compare: function (comparison, flagField) {

            var flagFieldIndexA, dataIndexA,
                flagFieldIndexB, dataIndexB,
                x, y, delta,
Severity: Minor
Found in lib/pixelComparator.js - About 1 hr to fix

Function loadDOMNode has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function loadDOMNode (inputNode, parentNode) {

            var nodes, length, offset, newNode;

            if (capturedTags.indexOf(inputNode.tagName) !== -1) {
Severity: Minor
Found in lib/scripts/structure.js - About 1 hr to fix

Function _compare has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _compare: function (imageA, imageB, imageOutput, deltaThreshold, outputMaskColor, outputShiftColor, backgroundColor, hShift, vShift, perceptual, gamma) {

        var result = {
            code: BlinkDiff.RESULT_UNKNOWN,
            differences: undefined,
Severity: Minor
Found in index.js - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

            if (this._gamma || this._gammaR || this._gammaG || this._gammaB) {
                gamma = {
                    r: this._gammaR || this._gamma, g: this._gammaG || this._gamma, b: this._gammaB || this._gamma
                };
            }
Severity: Major
Found in index.js - About 1 hr to fix

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

        _shiftCompare: function (x, y, colorIndex, comparison, imageSrc, areaSrc, imageDst, areaDst) {
Severity: Major
Found in lib/pixelComparator.js - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

            if (this._gamma || this._gammaR || this._gammaG || this._gammaB) {
                gamma = {
                    r: this._gammaR || this._gamma, g: this._gammaG || this._gamma, b: this._gammaB || this._gamma
                };
            }
Severity: Major
Found in index.js - About 1 hr to fix

Avoid deeply nested control flow statements.
Open

                            if ((Math.abs(delta - localDeltaThreshold) < deltaThreshold) &&
                                (localDeltaThreshold > deltaThreshold)) {
                                return true;
                            }
Severity: Major
Found in lib/pixelComparator.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if ((Math.abs(delta - localDeltaThreshold) < deltaThreshold) && (localDeltaThreshold > deltaThreshold)) {
                            return true;
                        }
Severity: Major
Found in index.js - About 45 mins to fix

Function getSelector has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        getSelector: function (suffix) {

            var id = this.getId(),
                tagName = this.getTagName(),
                classes = this.getClasses(),
Severity: Minor
Found in lib/configuration/structure/domElement.js - About 45 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

Function _correctGamma has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    _correctGamma: function (color, gamma) {

        // Convert to range [0, 1]
        var result = {
            c1: color.c1 / 255, c2: color.c2 / 255, c3: color.c3 / 255, c4: color.c4
Severity: Minor
Found in index.js - About 35 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

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

    _clip: function (imageA, imageB) {

        var minWidth, minHeight;

        if ((imageA.getWidth() != imageB.getWidth()) || (imageA.getHeight() != imageB.getHeight())) {
Severity: Minor
Found in index.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

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

        createComposition: function (imageA, imageB, imageOutput) {

            var width, height, image = imageOutput;

            if (!this.isCompositionOff()) {
Severity: Minor
Found in lib/configuration/output.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

Function BlinkDiff has a Cognitive Complexity of 6 (exceeds 5 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: Minor
Found in index.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

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

        processImage: function (comparison) {

            if (comparison.hasGamma && comparison.hasGamma()) {
                this.applyGamma(comparison.getGamma())
            }
Severity: Minor
Found in lib/image.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