jaredhanson/crane

View on GitHub

Showing 7 of 7 total issues

Function handle has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

app.handle = function(msg, out) {
  var self = this
    , stack = this._stack
    , idx = 0;
  
Severity: Minor
Found in lib/application.js - About 2 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 _dispatch has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

Router.prototype._dispatch = function(msg, next) {
  debug('dispatching %s (%s)', msg.topic, msg.originalTopic);
  
  var self = this;
  
Severity: Minor
Found in lib/router.js - About 2 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 handle has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

app.handle = function(msg, out) {
  var self = this
    , stack = this._stack
    , idx = 0;
  
Severity: Minor
Found in lib/application.js - About 1 hr to fix

    Function _dispatch has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Router.prototype._dispatch = function(msg, next) {
      debug('dispatching %s (%s)', msg.topic, msg.originalTopic);
      
      var self = this;
      
    Severity: Minor
    Found in lib/router.js - About 1 hr to fix

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

        function next(err) {
          var layer = stack[idx++];
          
          // all done
          if (!layer) {
      Severity: Minor
      Found in lib/application.js - About 1 hr to fix

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

          (function iter(i, err) {
            function nextRoute(err) {
              iter(i + 1, err);
            }
            
        Severity: Minor
        Found in lib/router.js - About 1 hr to fix

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

          Route.prototype.match = function(topic, params) {
            params = params || [];
            
            var keys = this.keys
              , m = this.regexp.exec(topic);
          Severity: Minor
          Found in lib/route.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