ripple/ripple-rest

View on GitHub

Showing 105 of 151 total issues

Function getFailedTransactions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

DI.getFailedTransactions = function(options, callback) {
  assert.strictEqual(typeof options, 'object');
  assert.strictEqual(typeof options.account, 'string');
  assert(ripple.UInt160.is_valid(options.account),
         'Specified account is invalid');
Severity: Minor
Found in api/lib/db-interface.js - About 1 hr to fix

    Function filtered_transactions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var filtered_transactions = transactions.filter(function(transaction) {
        if (options.exclude_failed) {
          if (transaction.state === 'failed' || (transaction.meta
              && transaction.meta.TransactionResult !== 'tesSUCCESS')) {
            return false;
    Severity: Minor
    Found in api/transactions.js - About 1 hr to fix

      Function createTxJSON has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function createTxJSON(transaction, remote, instructions, callback) {
        instructions = instructions || {};
        validate.options(instructions);
      
        transaction.complete();
      Severity: Minor
      Found in api/transaction/utils.js - About 1 hr to fix

        Function validateOptions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        function validateOptions(options) {
          if (options.max_fee !== undefined) {
            validateNonNegativeStringFloat(options.max_fee, 'max_fee');
          }
          if (options.fixed_fee !== undefined) {
        Severity: Minor
        Found in api/lib/validate.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 getLocalAndRemoteTransactions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getLocalAndRemoteTransactions(api, options, callback) {
        
          function queryRippled(_callback) {
            getAccountTx(api, options, function(error, results) {
              if (error) {
        Severity: Minor
        Found in api/transactions.js - About 1 hr to fix

          Function parseNotification has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function parseNotification(transaction, __callback) {
                var args = {
                  account: account,
                  identifier: transaction.hash,
                  transaction: transaction
          Severity: Minor
          Found in api/notifications.js - About 1 hr to fix

            Function validateTrustline has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function validateTrustline(trustline) {
              if (typeof trustline !== 'object') {
                throw error('Invalid parameter: trustline');
              }
              if (_.isUndefined(trustline.limit)) {
            Severity: Minor
            Found in api/lib/validate.js - About 1 hr to fix

              Function getAccountTx has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function getAccountTx(api, options, callback) {
                var params = {
                  account: options.account,
                  ledger_index_min: options.ledger_index_min || options.ledger_index || -1,
                  ledger_index_max: options.ledger_index_max || options.ledger_index || -1,
              Severity: Minor
              Found in api/transactions.js - About 1 hr to fix

                Function queryTransaction has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function queryTransaction(async_callback) {
                    api.db.getTransaction(options, function(error, entry) {
                      if (error) {
                        return async_callback(error);
                      }
                Severity: Minor
                Found in api/transactions.js - About 1 hr to fix

                  Function exports has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports = (function() {
                    var validator = new JaySchema();
                    var validate = validator.validate;
                  
                    // If schema is valid, return true. Otherwise
                  Severity: Minor
                  Found in api/lib/schema-validator.js - About 1 hr to fix

                    Function validateTrustline has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function validateTrustline(trustline) {
                      if (typeof trustline !== 'object') {
                        throw error('Invalid parameter: trustline');
                      }
                      if (_.isUndefined(trustline.limit)) {
                    Severity: Minor
                    Found in api/lib/validate.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 promise has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

                      Function findPreviousAndNextTransactions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function findPreviousAndNextTransactions(txns, callback) {
                      
                          // Find the index in the array of the baseTransaction
                          var baseTransactionIndex = _.findIndex(txns, function(possibility) {
                            if (possibility.hash === notificationDetails.transaction.hash) {
                      Severity: Minor
                      Found in api/notifications.js - About 1 hr to fix

                        Function validatePaymentMemos has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function validatePaymentMemos(memos) {
                          if (!Array.isArray(memos)) {
                            throw error(
                              'Invalid parameter: memos. Must be an array with memo objects');
                          }
                        Severity: Minor
                        Found in api/lib/validate.js - About 55 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 submitTransaction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function submitTransaction(api, tx, secret, options, callback) {
                          function blockDuplicates(transaction, _options, _callback) {
                            var transactionOptions = {
                              source_account: transaction.tx_json.Account,
                              client_resource_id: _options.clientResourceId,
                        Severity: Minor
                        Found in api/transactions.js - About 55 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 parseCurrencyQuery has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function parseCurrencyQuery(query) {
                          var params = query.split('+');
                        
                          if (!isNaN(params[0])) {
                            return {
                        Severity: Minor
                        Found in api/lib/utils.js - About 55 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 submitPayment has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        function submitPayment(account, payment, clientResourceID, secret,
                            urlBase, options, callback) {
                        Severity: Major
                        Found in api/payments.js - About 50 mins to fix

                          Function getFailedTransactions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          DI.getFailedTransactions = function(options, callback) {
                            assert.strictEqual(typeof options, 'object');
                            assert.strictEqual(typeof options.account, 'string');
                            assert(ripple.UInt160.is_valid(options.account),
                                   'Specified account is invalid');
                          Severity: Minor
                          Found in api/lib/db-interface.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 prepareAndOptionallySign has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          function prepareAndOptionallySign(transaction, api, secret, options,
                              converter, callback) {
                          Severity: Minor
                          Found in api/transact.js - About 45 mins to fix

                            Function transact has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            function transact(transaction, api, secret, options, converter, callback) {
                            Severity: Minor
                            Found in api/transact.js - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language