d-simon/node-pixelscreen

View on GitHub

Showing 4 of 4 total issues

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

PixelScreen.prototype.getImage = function (name) {
    if (!name) return this.image;
    if (!this.screens[name]) return;

    var screen = this.screens[name]
Severity: Minor
Found in index.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 createBalancedChannels has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

PixelScreen.prototype.createBalancedChannels = function (inputArray, expectedChannels) {
    // return channels and flatten or cut channels
    // if we have a difference in no. of channels
    var array = [];
    for (var k = 0; k < inputArray.length; k++) {
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 createImageArray has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function createImageArray (width, height, channels) {
    var array = [];
    for (var i = 0; i < height; i++) {
        array.push([]);
        for (var j = 0; j < width; j++) {
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 arrayToDMX has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

PixelScreen.prototype.arrayToDMX = function (input) {
    var dmx = [];
    for (var i = 0; i < input.length; i++) {
        for (var j = 0; j < input[i].length; j++) {
            for (var k = 0; k < input[i][j].length; k++) {
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

Severity
Category
Status
Source
Language