ripple/ripple-rest

View on GitHub

Showing 151 of 151 total issues

Function getNotifications has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getNotifications(account, urlBase, options, callback) {
  validate.address(account);

  var self = this;

Severity: Major
Found in api/notifications.js - About 2 hrs to fix

    File routes.js has 271 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    var _ = require('lodash');
    var api = require('./api');
    var respond = require('./response-handler');
    var config = require('./config');
    Severity: Minor
    Found in server/routes.js - About 2 hrs to fix

      Function getAccountTransactions has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getAccountTransactions(api, options, callback) {
        try {
          validate.address(options.account);
        } catch(err) {
          return callback(err);
      Severity: Major
      Found in api/transactions.js - About 2 hrs to fix

        Function parseOrderFromTx has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function parseOrderFromTx(tx, options) {
          if (!options.account) {
            throw new Error('Internal Error. must supply options.account');
          }
          if (tx.TransactionType !== 'OfferCreate'
        Severity: Major
        Found in api/lib/tx-to-rest-converter.js - About 2 hrs to fix

          Function getAccountTransactions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          function getAccountTransactions(api, options, callback) {
            try {
              validate.address(options.account);
            } catch(err) {
              return callback(err);
          Severity: Minor
          Found in api/transactions.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 getNotificationHelper has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function getNotificationHelper(api, account, identifier, urlBase, topCallback) {
          
            function getTransaction(callback) {
              try {
                transactions.getTransaction(api, account, identifier, {}, callback);
          Severity: Major
          Found in api/notifications.js - About 2 hrs to fix

            Function parse has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            NotificationParser.prototype.parse = function(notification_details, urlBase) {
              var transaction = notification_details.transaction;
              var account = notification_details.account;
              var previous_transaction_identifier =
                notification_details.previous_transaction_identifier;
            Severity: Minor
            Found in api/lib/notification_parser.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 setTransactionFields has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            function setTransactionFields(transaction, input, fieldSchema) {
              for (var fieldName in fieldSchema) {
                var field = fieldSchema[fieldName];
                var value = input[field.name];
            
            
            Severity: Minor
            Found in api/transaction/settings.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 getAccountLines has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function getAccountLines(prevResult) {
                var isAggregate = options.limit === 'all';
                if (prevResult && (!isAggregate || !prevResult.marker)) {
                  return Promise.resolve(prevResult);
                }
            Severity: Major
            Found in api/trustlines.js - About 2 hrs to fix

              Function attachPreviousAndNextTransactionIdentifiers has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              function attachPreviousAndNextTransactionIdentifiers(api,
                  notificationDetails, topCallback) {
              
                // Get all of the transactions affecting the specified
                // account in the given ledger. This is done so that
              Severity: Minor
              Found in api/notifications.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 parsePaymentFromTx has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              function parsePaymentFromTx(account, message, meta) {
                if (!account) {
                  throw new Error('Internal Error. must supply options.account');
                }
              
              
              Severity: Minor
              Found in api/lib/tx-to-rest-converter.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 validateSettings has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function validateSettings(settings) {
                if (typeof settings !== 'object') {
                  throw error('Invalid parameter: settings');
                }
                if (!/(undefined|string)/.test(typeof settings.domain)) {
              Severity: Major
              Found in api/lib/validate.js - About 2 hrs to fix

                File orders.js has 252 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /* globals Promise: true */
                /* eslint-disable valid-jsdoc */
                'use strict';
                var _ = require('lodash');
                var asyncify = require('simple-asyncify');
                Severity: Minor
                Found in api/orders.js - About 2 hrs to fix

                  Function getLineBalances has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function getLineBalances(prevResult) {
                      var isAggregate = options.limit === 'all';
                      if (prevResult && (!isAggregate || !prevResult.marker)) {
                        return Promise.resolve(prevResult);
                      }
                  Severity: Minor
                  Found in api/balances.js - About 1 hr to fix

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

                        var promise = new Promise(function(resolve, reject) {
                          var accountLinesRequest;
                          var marker;
                          var ledger;
                          var limit;
                    Severity: Minor
                    Found in api/trustlines.js - About 1 hr to fix

                      Function getOrders has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function getOrders(account, options, callback) {
                        var self = this;
                      
                        validate.address(account);
                        validate.options(options);
                      Severity: Minor
                      Found in api/orders.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 getAccountPayments has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function getAccountPayments(account, source_account, destination_account,
                          direction, options, callback) {
                        var self = this;
                      
                        function getTransactions(_callback) {
                      Severity: Minor
                      Found in api/payments.js - About 1 hr to fix

                        Function createRemote has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function createRemote(options) {
                          var remote = new ripple.Remote(options);
                          if (options.mock) {
                            return remote;
                          }
                        Severity: Minor
                        Found in api/lib/remote.js - About 1 hr to fix

                          Function parsePaymentFromTx has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function parsePaymentFromTx(account, message, meta) {
                            if (!account) {
                              throw new Error('Internal Error. must supply options.account');
                            }
                          
                          
                          Severity: Minor
                          Found in api/lib/tx-to-rest-converter.js - About 1 hr to fix

                            Function promise has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                var promise = new Promise(function(resolve, reject) {
                                  var accountLinesRequest;
                                  var marker;
                                  var ledger;
                                  var limit;
                            Severity: Minor
                            Found in api/balances.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language