Bruce17/dependable

View on GitHub

Showing 10 of 10 total issues

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

exports.load = function load(fileOrDir, subDirs, options) {
    // Maybe the user only passed two arguments an "path" + "options". Adjust the arguments in that case.
    if (options === undefined) {
        if (Utils.isObject(subDirs)) {
            options = subDirs;
Severity: Minor
Found in source/library.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 get has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.get = function get(name, overrides, visited) {
    if (visited === undefined) {
        visited = [];
    }

Severity: Minor
Found in source/library.js - About 1 hr to fix

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

    exports.load = function load(fileOrDir, subDirs, options) {
        // Maybe the user only passed two arguments an "path" + "options". Adjust the arguments in that case.
        if (options === undefined) {
            if (Utils.isObject(subDirs)) {
                options = subDirs;
    Severity: Minor
    Found in source/library.js - About 1 hr to fix

      Function get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.get = function get(name, overrides, visited) {
          if (visited === undefined) {
              visited = [];
          }
      
      
      Severity: Minor
      Found in source/library.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 registerLibrary has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.registerLibrary = function registerLibrary(name, func) {
          if (Utils.isObject(name)) {
              var hash = name;
              var results = [];
      
      
      Severity: Minor
      Found in source/library.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 register has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.register = function register(name, func) {
          if (Utils.isObject(name)) {
              var hash = name;
              var results = [];
      
      
      Severity: Minor
      Found in source/library.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 find has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.find = function find(searchPattern) {
          var result = {};
          var key;
      
          // Prepare a regex to select a specific set of the permissions.
      Severity: Minor
      Found in source/library.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 inArray has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.inArray = function inArray(haystack, needle) {
          var result = false;
      
          if (this.isArray(haystack)) {
              var count = haystack.length;
      Severity: Minor
      Found in source/utils.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 loadDir has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      var loadDir = function loadDir(dir, options) {
          var fileNames = fs.readdirSync(dir);
          var files = fileNames.map(function(file) {
              return path.join(dir, file);
          });
      Severity: Minor
      Found in source/library.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 getFileStats has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      var getFileStats = function (fileOrPath, fileEnding) {
          var hasFileEnding = (typeof fileEnding === 'string');
      
          try {
              return fs.lstatSync(fileOrPath + (hasFileEnding ? fileEnding : ''));
      Severity: Minor
      Found in source/library.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