maael/node-data-preprocessing

View on GitHub

Showing 13 of 13 total issues

Function validateRange has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

function validateRange(value, range) {
    var check = true;
    var validators = {
        greater: function (value, min) {
            if(typeof(value) === 'object') {
Severity: Minor
Found in lib/cleanse.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 validateRange has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function validateRange(value, range) {
    var check = true;
    var validators = {
        greater: function (value, min) {
            if(typeof(value) === 'object') {
Severity: Major
Found in lib/cleanse.js - About 2 hrs to fix

    Function cleanse has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    var cleanse = function(options, data) {
        options = options || {};
        options.formats = options.formats || [];
        options.ranges = options.ranges || [];
        var dataLength = data[0].length,
    Severity: Minor
    Found in lib/cleanse.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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            between: function (value, range) {
                var parts = range.split('-'),
                    min = parts[0],
                    max = parts[1];
                return this.greater(value, min) && this.less(value, max);
    Severity: Major
    Found in lib/cleanse.js and 1 other location - About 1 hr to fix
    lib/cleanse.js on lines 67..72

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 70.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            betweenOrEqual: function (value, range) {
                var parts = range.split('-'),
                    min = parts[0],
                    max = parts[1];
                return this.greaterOrEqual(value, min) && this.lessOrEqual(value, max);
    Severity: Major
    Found in lib/cleanse.js and 1 other location - About 1 hr to fix
    lib/cleanse.js on lines 61..66

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 70.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function standardise has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    var standardise = function(options, data) {
        options = options || {};
        options.path = options.path || '';
        options.format = options.format || 'csv';
        options.min = options.min || 0.1;
    Severity: Minor
    Found in lib/standardise.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 standardise has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var standardise = function(options, data) {
        options = options || {};
        options.path = options.path || '';
        options.format = options.format || 'csv';
        options.min = options.min || 0.1;
    Severity: Minor
    Found in lib/standardise.js - About 1 hr to fix

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

      var extract = function(options, source) {
          options = options || {};
          options.path = options.path || '';
          options.format = options.format || 'csv';
          options.useHeaders = options.useHeaders || false;
      Severity: Minor
      Found in lib/extract.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

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

              less: function (value, max) {
                  if(typeof(value) === 'object') {
                      return value.lesser(max);
                  } else {
                      return value < max;
      Severity: Major
      Found in lib/cleanse.js and 3 other locations - About 35 mins to fix
      lib/cleanse.js on lines 33..39
      lib/cleanse.js on lines 40..46
      lib/cleanse.js on lines 54..60

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 47.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

              greaterOrEqual: function (value, min) {
                  if(typeof(value) === 'object') {
                      return value.greaterOrEquals(min);
                  } else {
                      return value >= min;
      Severity: Major
      Found in lib/cleanse.js and 3 other locations - About 35 mins to fix
      lib/cleanse.js on lines 33..39
      lib/cleanse.js on lines 47..53
      lib/cleanse.js on lines 54..60

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 47.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

              lessOrEqual: function (value, max) {
                  if(typeof(value) === 'object') {
                      return value.lesserOrEquals(max);
                  } else {
                      return value <= max;
      Severity: Major
      Found in lib/cleanse.js and 3 other locations - About 35 mins to fix
      lib/cleanse.js on lines 33..39
      lib/cleanse.js on lines 40..46
      lib/cleanse.js on lines 47..53

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 47.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

              greater: function (value, min) {
                  if(typeof(value) === 'object') {
                      return value.greater(min);
                  } else {
                      return value > min;
      Severity: Major
      Found in lib/cleanse.js and 3 other locations - About 35 mins to fix
      lib/cleanse.js on lines 40..46
      lib/cleanse.js on lines 47..53
      lib/cleanse.js on lines 54..60

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 47.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function divide has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      var divide = function(options, data) {
          options = options || {};
          options.random = options.random || false;
          options.splits = options.splits || [60, 20, 20];
          var divisionSizes = [],
      Severity: Minor
      Found in lib/divide.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

      Severity
      Category
      Status
      Source
      Language