noodlefrenzy/node-amqp10

View on GitHub
lib/sender_link.js

Summary

Maintainability
C
1 day
Test Coverage

Function send has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

SenderLink.prototype.send = function(msg, options) {
  options = options || {};

  var noReply = false;
  if (options.hasOwnProperty('noReply')) {
Severity: Minor
Found in lib/sender_link.js - About 3 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 send has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

SenderLink.prototype.send = function(msg, options) {
  options = options || {};

  var noReply = false;
  if (options.hasOwnProperty('noReply')) {
Severity: Major
Found in lib/sender_link.js - About 2 hrs to fix

    Function _sendMessage has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    SenderLink.prototype._sendMessage = function(message, options) {
      // preconditions
      if (this.linkCredit <= 0) {
        throw new errors.OverCapacityError('Cannot send if no link credit.');
      }
    Severity: Minor
    Found in lib/sender_link.js - About 1 hr to fix

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

      SenderLink.prototype._sendMessage = function(message, options) {
        // preconditions
        if (this.linkCredit <= 0) {
          throw new errors.OverCapacityError('Cannot send if no link credit.');
        }
      Severity: Minor
      Found in lib/sender_link.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 _dispositionReceived has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      SenderLink.prototype._dispositionReceived = function(details) {
        if (!details.settled) {
          return;
        }
      
      
      Severity: Minor
      Found in lib/sender_link.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 _dispatchPendingSends has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      SenderLink.prototype._dispatchPendingSends = function(err) {
        if (this._pendingSends && this._pendingSends.length !== 0) {
          while (this._pendingSends.length > 0 && (!!err ? true : this.canSend())) {
            var sendMessage = this._pendingSends.shift();
            sendMessage(err);
      Severity: Minor
      Found in lib/sender_link.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

      There are no issues that match your filters.

      Category
      Status