shernshiou/node-uber

View on GitHub

Showing 31 of 31 total issues

Function replaceAddressWithCoordinates has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  replaceAddressWithCoordinates(params, addressField, latField, lngField, callback) {
Severity: Minor
Found in lib/Uber.js - About 35 mins to fix

    Function getPayments has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    PartnerPayments.prototype.getPayments = function getPayments(off, lim, from, to, callback) {
    Severity: Minor
    Found in lib/resources/drivers/PartnerPayments.js - About 35 mins to fix

      Function getTrips has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      PartnerTrips.prototype.getTrips = function getTrips(off, lim, from, to, callback) {
      Severity: Minor
      Found in lib/resources/drivers/PartnerTrips.js - About 35 mins to fix

        Function updateByID has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        Requests.prototype.updateByID = function updateByID(id, parameters, callback) {
            if (!id) {
                return callback(new Error('Invalid request_id'));
            }
        
        
        Severity: Minor
        Found in lib/resources/riders/Requests.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

        Avoid too many return statements within this function.
        Open

              return false;
        Severity: Major
        Found in lib/Uber.js - About 30 mins to fix

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

          Products.prototype.setDriversAvailabilityByID = function setDriversAvailabilityByID(id, availability, 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 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