noodlefrenzy/node-amqp10

View on GitHub

Showing 105 of 189 total issues

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

module.exports.decodeMessage = function(buffer) {
  var message = {};
  var curIdx = 0;
  while (curIdx < buffer.length) {
    var decoded = codec.decode(buffer, curIdx);
Severity: Minor
Found in lib/types/message.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 _encodeNumber has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

Codec.prototype._encodeNumber = function(value, buffer) {
  if (isNaN(value) || !isFinite(value)) {
    throw new errors.EncodingError(value, 'value is not a finite number');
  }

Severity: Minor
Found in lib/codec.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 createSender has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

AMQPClient.prototype.createSender = function(address, policyOverrides, session) {
  if (!this._connection) {
    throw new Error('Must connect before creating links');
  }

Severity: Minor
Found in lib/amqp_client.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 _getSession has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

AMQPClient.prototype._getSession = function(session) {
  // Just return the provided session if one was passed in
  if (session) {
    return Promise.resolve(session);
  }
Severity: Minor
Found in lib/amqp_client.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 AMQPClient has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function AMQPClient(policy, policyOverrides) {
  if (!(policy instanceof Policy)) {
    this.policy = pu.Merge(policy, new Policy());
  } else {
    this.policy = policy || new Policy();
Severity: Minor
Found in lib/amqp_client.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