adamrenklint/asimov-core

View on GitHub

Showing 4 of 4 total issues

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

  'recursiveDelete': function (path) {

    var self = this;

    if (!self.pathExists(path)) return;
Severity: Minor
Found in lib/Filesystem.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 assert has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  'assert': function (type, o, message) {

    var self = this;
    message = message || 'Invalid type: expected ' + type + ', got ' + o.toString();

Severity: Minor
Found in lib/Klass.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 (type == 'defined' && !!!o || type === 'number' && isNaN(o) || typeof method === 'function' && !method(o)) {

      if (typeof message === 'function') {
        message();
      }
Severity: Major
Found in lib/Klass.js - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

        if (options.autoEncode && (self.hasFileExtension(filename, 'txt') || self.hasFileExtension(filename, 'tmpl') || self.hasFileExtension(filename, 'html') || self.hasFileExtension(filename, 'styl') || self.hasFileExtension(filename, 'js'))) {
          return fs.readFileSync(path, 'utf8');
        }
        else {
          return fs.readFileSync(path);
    Severity: Major
    Found in lib/Filesystem.js - About 40 mins to fix
      Severity
      Category
      Status
      Source
      Language