skratchdot/color-blind

View on GitHub

Showing 5 of 13 total issues

Function Blind has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

exports.Blind = function (rgb, type, anomalize) {
    var z, v, n,
        line, c, slope,
        yi, dx, dy,
        dX, dY, dZ,
Severity: Minor
Found in lib/blind.js - About 3 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 Blind has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.Blind = function (rgb, type, anomalize) {
    var z, v, n,
        line, c, slope,
        yi, dx, dy,
        dX, dY, dZ,
Severity: Major
Found in lib/blind.js - About 2 hrs to fix

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

    var createBlinder = function (key) {
        return function (colorString, returnRgb) {
            var color = onecolor(colorString);
            if (!color) {
                return returnRgb ? {R:0,G:0,B:0} : '#000000';
    Severity: Minor
    Found in lib/color-blind.js - About 1 hr to fix

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

      var createBlinder = function (key) {
          return function (colorString, returnRgb) {
              var color = onecolor(colorString);
              if (!color) {
                  return returnRgb ? {R:0,G:0,B:0} : '#000000';
      Severity: Minor
      Found in lib/color-blind.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 convertRgbToXyz has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      var convertRgbToXyz = function (o) {
          var M = matrixRgbXyz;
          var z = {};
          var R = o.R / 255;
          var G = o.G / 255;
      Severity: Minor
      Found in lib/blind.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

      Severity
      Category
      Status
      Source
      Language