shernshiou/node-uber

View on GitHub

Showing 25 of 31 total issues

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

Estimates.prototype.getPriceForRoute = function getPriceForRoute(startLat,
    startLon, endLat, endLon, seats, callback) {
    // seats is optional
    if (typeof seats === 'function') {
        callback = seats;
Severity: Minor
Found in lib/resources/riders/Estimates.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 replaceAddressWithCoordinates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

Uber.prototype.replaceAddressWithCoordinates = function
  replaceAddressWithCoordinates(params, addressField, latField, lngField, callback) {
  if (this.hasOwnNestedProperty(params, addressField) && !this.getNestedProperty(params, latField) && !this.getNestedProperty(params, lngField)) {
    // get coordinates from address
    this.getCoordinatesForAddress(this.getNestedProperty(params, addressField), function (err, data) {
Severity: Minor
Found in lib/Uber.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 getCoordinatesForAddress has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

Uber.prototype.getCoordinatesForAddress = function getCoordinatesForAddress(address, callback) {
  this.geocoder.geocode(address, function (err, data) {
    if (err || data.length === 0) {
      return callback((err
        ? err
Severity: Minor
Found in lib/Uber.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 setSurgeMultiplierByID has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

Products.prototype.setSurgeMultiplierByID = function setSurgeMultiplierByID(id, multiplier, callback) {
    if (!id) {
        return callback(new Error('Invalid product_id'));
    }

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

Requests.prototype.getEstimates = function getEstimates(parameters, callback) {
    if (!parameters) {
        return callback(new Error('Invalid parameters'));
    }

Severity: Minor
Found in lib/resources/riders/Requests.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