slm-lang/slm

View on GitHub
lib/vm.js

Summary

Maintainability
C
1 day
Test Coverage

Function mixin has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

VMProto.mixin = function() {
  var name = arguments[0];

  var lastArgument = arguments[arguments.length - 1];
  if (typeof lastArgument === 'function') { // mixin definition
Severity: Minor
Found in lib/vm.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 mixin has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

VMProto.mixin = function() {
  var name = arguments[0];

  var lastArgument = arguments[arguments.length - 1];
  if (typeof lastArgument === 'function') { // mixin definition
Severity: Major
Found in lib/vm.js - About 2 hrs to fix

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

    function escape(str) {
      if (typeof str !== 'string') {
        if (!str) {
          return '';
        }
    Severity: Minor
    Found in lib/vm.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 content has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    VMProto.content = function() {
      var cb, mod, name;
      switch (arguments.length) {
        case 0: // return main content
          return safe(this.res);
    Severity: Minor
    Found in lib/vm.js - About 1 hr to fix

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

      VMProto.content = function() {
        var cb, mod, name;
        switch (arguments.length) {
          case 0: // return main content
            return safe(this.res);
      Severity: Minor
      Found in lib/vm.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

      There are no issues that match your filters.

      Category
      Status