yahoo/pngjs-image

View on GitHub

Showing 66 of 322 total issues

File tests.js has 544 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 PNG = require('pngjs').PNG;
var PNGImage = require('../index');
Severity: Major
Found in test/tests.js - About 1 day to fix

File sizes.js has 543 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

var testGen = require('../testGen');

Severity: Major
Found in test/png/decode/sizes.js - About 1 day to fix

File gamma.js has 443 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

var testGen = require('../../testGen');
var expect = require('chai').expect;
Severity: Minor
Found in test/png/decode/ancillary/gamma.js - About 6 hrs to fix

exports has 47 functions (exceeds 20 allowed). Consider refactoring.
Open

module.exports = {

    /**
     * Gets the sequence
     *
Severity: Minor
Found in lib/png/chunks/IHDR.js - About 6 hrs to fix

File IHDR.js has 331 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

// IHDR - Image header

Severity: Minor
Found in lib/png/chunks/IHDR.js - About 3 hrs to fix

Function addDecodeTests has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    addDecodeTests: function (options) {

        before(function () {
            this.file = this.resource(options.resourceGroup, options.resourceFile + '.png');
        });
Severity: Major
Found in test/png/testGen.js - About 3 hrs to fix

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

    decode: function (image, strict, options) {

        var i, len, index,
            r, g, b, alpha,
            headerChunk,
Severity: Minor
Found in lib/png/chunks/tRNS.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 encodeData has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    encodeData: function (image, options) {

        if (options.chromaticities) {

            var chunk = this.createChunk(this.getType(), this.getChunks());
Severity: Minor
Found in lib/png/chunks/cHRM.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 parse has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    parse: function (stream, length, strict, options) {

        var maxWidth, maxHeight, maxDim, maxSize;

        // Validation
Severity: Minor
Found in lib/png/chunks/IHDR.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 parse has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    parse: function (stream, length, strict, options) {

        var headerChunk,
            paletteChunk,
            colorType,
Severity: Major
Found in lib/png/chunks/tRNS.js - About 2 hrs to fix

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

    parse: function (stream, length, strict, options) {

        var headerChunk,
            paletteChunk,
            color,
Severity: Minor
Found in lib/png/chunks/bKGD.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

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

module.exports = {

    /**
     * Gets the sequence
     *
Severity: Minor
Found in lib/png/chunks/cHRM.js - About 2 hrs to fix

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

    parse: function (stream, length, strict, options) {

        var headerChunk,
            paletteChunk,
            colorType,
Severity: Minor
Found in lib/png/chunks/tRNS.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 interlace.js has 253 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

var testGen = require('../testGen');

Severity: Minor
Found in test/png/decode/interlace.js - About 2 hrs to fix

File basic.js has 253 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

var testGen = require('../testGen');

Severity: Minor
Found in test/png/decode/basic.js - About 2 hrs to fix

Function decode has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Decoder.prototype.decode = function (buffer, options) {

    options = options || {};

    var i, len,
Severity: Minor
Found in lib/png/decoder.js - About 1 hr to fix

Function getBlurPixelAtIndex has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    getBlurPixelAtIndex: function (idx, funcName) {

        var colors = 0,
            colorCounter = 0,
            fn,
Severity: Minor
Found in lib/conversion.js - About 1 hr to fix

Function parse has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    parse: function (stream, length, strict, options) {

        var maxWidth, maxHeight, maxDim, maxSize;

        // Validation
Severity: Minor
Found in lib/png/chunks/IHDR.js - About 1 hr to fix

Function parse has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    parse: function (stream, length, strict, options) {

        var headerChunk,
            paletteChunk,
            color,
Severity: Minor
Found in lib/png/chunks/bKGD.js - About 1 hr to fix

Function _determineWriter has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

Normalizer.prototype._determineWriter = function () {

    var headerChunk = this.getHeaderChunk(),
        isColor, hasAlpha, isIndexed,
        result = null;
Severity: Minor
Found in lib/png/processor/normalizer.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