yoctore/yocto-utils

View on GitHub

Showing 12 of 37 total issues

Function generateAsciiCharsList has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

Str.prototype.generateAsciiCharsList = function (alpha, num, special, toLower) {
  // Default chars for appending
  var s = '';

  // Generate list
Severity: Minor
Found in src/modules/strings/index.js - About 4 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 generateList has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

YDate.prototype.generateList = function (min, max, prefixMin, prefixMax, reverse) {
  // Default list
  var list = [];

  try {
Severity: Minor
Found in src/modules/date/index.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 generateList has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

YDate.prototype.generateList = function (min, max, prefixMin, prefixMax, reverse) {
  // Default list
  var list = [];

  try {
Severity: Minor
Found in src/modules/date/index.js - About 1 hr to fix

    Function exports has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function (grunt) {
      // Init config
      grunt.initConfig({
        // Default package
        pkg : grunt.file.readJSON('package.json'),
    Severity: Minor
    Found in Gruntfile.js - About 1 hr to fix

      Function randomizedPassword has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      Crypto.prototype.randomizedPassword = function (n, level) {
        // Choose complexity level of password
        // 1 : easy - 2 middle - 3 huge
        level = !_.isUndefined(level) && _.isNumber(level) && (level >= 1 && level <= 3) ? level : 3;
      
      
      Severity: Minor
      Found in src/modules/crypto/index.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

      Consider simplifying this complex logical expression.
      Open

            if (i >= 33 && i <= 47 || i >= 58 && i <= 64 || i >= 91 && i <= 96 || i >= 123 && i <= 126) {
              s += String.fromCharCode(i);
            }
      Severity: Critical
      Found in src/modules/strings/index.js - About 1 hr to fix

        Function randomizedPassword has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Crypto.prototype.randomizedPassword = function (n, level) {
          // Choose complexity level of password
          // 1 : easy - 2 middle - 3 huge
          level = !_.isUndefined(level) && _.isNumber(level) && (level >= 1 && level <= 3) ? level : 3;
        
        
        Severity: Minor
        Found in src/modules/crypto/index.js - About 1 hr to fix

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

          ObjUtil.prototype.walk = function (obj) {
            // First test
            if (!obj || !_.isObject(obj)) {
              // Default statement
              return obj;
          Severity: Minor
          Found in src/modules/obj/objutil/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 generateList has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          YDate.prototype.generateList = function (min, max, prefixMin, prefixMax, reverse) {
          Severity: Minor
          Found in src/modules/date/index.js - About 35 mins to fix

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

              function (actualDate, limitDate, difference, firstPassage) {
              // Find a valid day from the actualDate
                var validDate = this.findNextValidDay(actualDate);
            
                // Check if the validDate is not BetweenOpenPlanning & if isBefore the limitDate
            Severity: Minor
            Found in src/modules/date/elapsed/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

            Avoid too many return statements within this function.
            Open

              return _.reduce(Object.keys(obj), function (acc, key) {
                // Camelcase
                var state = this.camelize ? this.str.camelCase(key) : this.str.underscore(key);
            
                // Assign
            Severity: Major
            Found in src/modules/obj/objutil/index.js - About 30 mins to fix

              Function isSpecialChar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              Str.prototype.isSpecialChar = function (value) {
                // Char At zero
                var zero = value.charCodeAt(0);
              
                // Default statement
              Severity: Minor
              Found in src/modules/strings/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