yahoo/pngjs-image

View on GitHub

Showing 66 of 322 total issues

Function setAtIndex has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    setAtIndex: function (idx, color) {
        if (typeof color === 'object') {
            if (color.red !== undefined) this.setRed(idx, color.red, color.opacity);
            if (color.green !== undefined) this.setGreen(idx, color.green, color.opacity);
            if (color.blue !== undefined) this.setBlue(idx, color.blue, color.opacity);
Severity: Minor
Found in lib/pixel.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 BufferedStream has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

var BufferedStream = function (data, offset, length) {

    this.readOffset = 0;
    this.writeOffset = 0;

Severity: Minor
Found in lib/png/utils/bufferedStream.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 preEncode has a Cognitive Complexity of 10 (exceeds 5 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

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 addEncodeTests has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    addEncodeTests: function (options) {

        before(function () {
            this.file = this.resource(options.resourceGroup, options.resourceFile + '.raw');
            this.finalFile = this.resource((options.outputGroup || options.resourceGroup), (options.outputFile || options.resourceFile) + '_enc.png');
Severity: Minor
Found in test/png/testGen.js - About 1 hr to fix

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

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

        var i, len, foundIndex = null, buffer, string,
            compressor,
            data,
Severity: Minor
Found in lib/png/custom/jsOn.js - About 1 hr to fix

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

function generateBlob () {

    var buffer = new Buffer(2 * 3 * 4);

    buffer[0] = 18; // Red
Severity: Minor
Found in test/tests.js - About 1 hr to fix

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

Filter.prototype.encode = function (image) {

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

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

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

Filter.prototype.decode = function (image) {

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

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

Function getSepiaAtIndex has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    getSepiaAtIndex: function (idx) {
        var r = this.getRed(idx),
            g = this.getGreen(idx),
            b = this.getBlue(idx);

Severity: Minor
Found in lib/conversion.js - About 55 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 getYIQAtIndex has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    getYIQAtIndex: function (idx) {

        var r = this.getRed(idx),
            g = this.getGreen(idx),
            b = this.getBlue(idx),
Severity: Minor
Found in lib/conversion.js - About 55 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 _determineScaler has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

Scaler.prototype._determineScaler = function () {

    var headerChunk = this.getHeaderChunk(),
        isIndexed, bitDepth,

Severity: Minor
Found in lib/png/processor/scaler.js - About 55 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 postDecode has a Cognitive Complexity of 9 (exceeds 5 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 55 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 encodeData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    encodeData: function (image, options) {

        if (options.offset) {

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

    encodeData: function (image, options) {

        if (options.physicalScale) {

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

    encodeData: function (image, options) {

        if (options.physicalSize) {

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

Chunk.decodeTypeData = function (type, decodeData, chunks, strict, options) {
Severity: Minor
Found in lib/png/chunk.js - About 35 mins to fix

Function fillRect has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    fillRect: function (x, y, width, height, color) {
Severity: Minor
Found in index.js - About 35 mins to fix

Function compareBuffers has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function compareBuffers (bufferActual, bufferExpected, actualOffset, expectedOffset, length) {
Severity: Minor
Found in test/tests.js - About 35 mins to fix

Function encode has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    this.encode = function (path, buffer, width, height, options) {
Severity: Minor
Found in test/png/utils.js - About 35 mins to fix
Severity
Category
Status
Source
Language