ripple/ripple-rest

View on GitHub

Showing 105 of 151 total issues

Function createPaymentTransaction has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createPaymentTransaction(account, payment) {
  validate.address(account);
  validate.payment(payment);

  // Convert blank issuer to sender's address
Severity: Major
Found in api/transaction/payment.js - About 3 hrs to fix

    Function getOrders has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getOrders(account, options, callback) {
      var self = this;
    
      validate.address(account);
      validate.options(options);
    Severity: Major
    Found in api/orders.js - About 2 hrs to fix

      File tx-to-rest-converter.js has 278 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* eslint-disable valid-jsdoc */
      'use strict';
      var ripple = require('ripple-lib');
      var utils = require('./utils');
      var _ = require('lodash');
      Severity: Minor
      Found in api/lib/tx-to-rest-converter.js - About 2 hrs to fix

        Function saveTransaction has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        DI.saveTransaction = function(transaction, callback) {
          assert.strictEqual(typeof transaction, 'object');
          assert(transaction.state, 'Transaction missing property: state');
          assert(transaction.tx_json, 'Transaction missing property: tx_json');
          assert(transaction.tx_json.TransactionType,
        Severity: Major
        Found in api/lib/db-interface.js - About 2 hrs to fix

          Function parse has 65 lines of code (exceeds 25 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: Major
          Found in api/lib/notification_parser.js - About 2 hrs to fix

            Function validateSettings has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            function validateSettings(settings) {
              if (typeof settings !== 'object') {
                throw error('Invalid parameter: settings');
              }
              if (!/(undefined|string)/.test(typeof settings.domain)) {
            Severity: Minor
            Found in api/lib/validate.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 getTrustLines has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            function getTrustLines(account, options, callback) {
              validate.address(account);
              validate.currency(options.currency, true);
              validate.counterparty(options.counterparty, true);
              validate.options(options);
            Severity: Minor
            Found in api/trustlines.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 parseOrderFromTx has a Cognitive Complexity of 19 (exceeds 5 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: 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 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
                          Severity
                          Category
                          Status
                          Source
                          Language