yahoo/pngjs-image

View on GitHub

Showing 66 of 322 total issues

Function getBlurPixelAtIndex has a Cognitive Complexity of 13 (exceeds 5 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

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 finalizeDecode has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    finalizeDecode: function (image, strict, options) {

        var i, len,
            imageStream, outputStream,
            r, g, b, a,
Severity: Minor
Found in lib/png/chunks/gAMA.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 _determineWriter has 39 lines of code (exceeds 25 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

Function postDecode has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    postDecode: function (image, strict, options) {

        var i, len, index, alpha,
            color, colors, colorsLength,
            imageStream, outputStream,
Severity: Minor
Found in lib/png/chunks/PLTE.js - About 1 hr to fix

Function _parse1bit has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Parser.prototype._parse1bit = function (paddingAt) {

    var byteCounter = 0;

    return function (value, output) {
Severity: Minor
Found in lib/png/processor/parser.js - About 1 hr to fix

Function postDecode has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    postDecode: function (image, strict, options) {

        var i, len,
            imageStream, outputStream,
            backgroundColor,
Severity: Minor
Found in lib/png/chunks/bKGD.js - About 1 hr to fix

Function compose has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    compose: function (stream, options) {

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

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

Function processPasses has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Interlace.prototype.processPasses = function (cb) {

    var headerChunk = this.getHeaderChunk(),

        height = headerChunk.getHeight(),
Severity: Minor
Found in lib/png/processor/interlace.js - About 1 hr to fix

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

Interlace.prototype._adam7 = function (data, width, height, revert) {

    // Suggested implementation from the spec:
    // http://www.libpng.org/pub/png/spec/1.1/PNG-Decoders.html

Severity: Minor
Found in lib/png/processor/interlace.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 compose has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    compose: function (stream, options) {

        var headerChunk, paletteChunk,
            colorType, color,
            i,
Severity: Minor
Found in lib/png/chunks/tRNS.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 _parseChunk has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Decoder.prototype._parseChunk = function (stream, strict, options) {

    var chunkLength,
        chunkType,
        chunkCrc,
Severity: Minor
Found in lib/png/decoder.js - About 1 hr to fix

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

Filter.prototype._optimalEncode = function (info, options) {

    var filterList = [4, 3, 2, 1, 0],
        filterType,
        filterMapping,
Severity: Minor
Found in lib/png/processor/filter.js - About 1 hr to fix

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

    preEncode: function (image, options) {

        var imageStream, scaledStream, reducedStream, withdrawnStream,
            interlace;

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

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

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

    finalizeDecode: function (image, strict, options) {

        var i, len,
            imageStream, outputStream,
            r, g, b, a,
Severity: Minor
Found in lib/png/chunks/gAMA.js - About 1 hr to fix

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

    applyFilters: function (filters, returnResult) {

        var image,
            newFilters;

Severity: Minor
Found in index.js - About 1 hr to fix

Function encode has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Encoder.prototype.encode = function (image, width, height, options) {

    options = options || {};

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

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

Parser.prototype.decode = function (image) {

    var headerChunk = this.getHeaderChunk(),
        interlace = new Interlace(headerChunk),

Severity: Minor
Found in lib/png/processor/parser.js - About 1 hr to fix

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

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

        var i, len,
            foundIndex = null,
            buffer, string,
Severity: Minor
Found in lib/png/chunks/zTXt.js - About 1 hr to fix
Severity
Category
Status
Source
Language