ripple/ripple-rest

View on GitHub

Showing 151 of 151 total issues

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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    function placeOrder(account, order, secret, options, callback) {
      var transaction = createOrderTransaction(account, order);
      var converter = TxToRestConverter.parseSubmitOrderFromTx;
      transact(transaction, this, secret, options, converter, callback);
    }
    Severity: Minor
    Found in api/orders.js and 1 other location - About 50 mins to fix
    api/orders.js on lines 180..184

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 52.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    function cancelOrder(account, sequence, secret, options, callback) {
      var transaction = createOrderCancellationTransaction(account, sequence);
      var converter = TxToRestConverter.parseCancelOrderFromTx;
      transact(transaction, this, secret, options, converter, callback);
    }
    Severity: Minor
    Found in api/orders.js and 1 other location - About 50 mins to fix
    api/orders.js on lines 162..166

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 52.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        message: (error.remote ? error.remote.error_message : null)
          || error.engine_result_message || error.error_message || error.message
          || error
    Severity: Minor
    Found in server/error-handler.js and 1 other location - About 50 mins to fix
    server/error-handler.js on lines 39..40

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 51.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    function renameCounterpartyToIssuerInOrderChanges(orderChanges) {
      return _.mapValues(orderChanges, function(changes) {
        return _.map(changes, function(change) {
          return utils.renameCounterpartyToIssuerInOrder(change);
        });
    Severity: Minor
    Found in api/lib/tx-to-rest-converter.js and 1 other location - About 50 mins to fix
    api/lib/tx-to-rest-converter.js on lines 22..28

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 51.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        error: (error.remote ? error.remote.error : null)
          || error.engine_result || error.error || error.message || error,
    Severity: Minor
    Found in server/error-handler.js and 1 other location - About 50 mins to fix
    server/error-handler.js on lines 41..43

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 51.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    function renameCounterpartyToIssuerInBalanceChanges(balanceChanges) {
      return _.mapValues(balanceChanges, function(changes) {
        return _.map(changes, function(change) {
          return utils.renameCounterpartyToIssuer(change);
        });
    Severity: Minor
    Found in api/lib/tx-to-rest-converter.js and 1 other location - About 50 mins to fix
    api/lib/tx-to-rest-converter.js on lines 14..20

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 51.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

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

        function submitPayment(account, payment, clientResourceID, secret,
            urlBase, options, callback) {
        
          function formatTransactionResponse(message, meta) {
            if (meta.state === 'validated') {
        Severity: Minor
        Found in api/payments.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 getAccountPayments has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function getAccountPayments(account, source_account, destination_account,
            direction, options, callback) {
        Severity: Minor
        Found in api/payments.js - About 45 mins to fix

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

          function parseCurrencyAmount(rippledAmount, useIssuer) {
            var amount = {};
          
            if (typeof rippledAmount === 'string') {
              amount.currency = 'XRP';
          Severity: Minor
          Found in api/lib/utils.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 prepareAndSignAndSubmit has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

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

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

            DI.getTransaction = function(options, callback) {
              assert.strictEqual(typeof options, 'object');
            
              var txQuery = {};
            
            
            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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              if (options.validated !== undefined && !_.isBoolean(options.validated)) {
                throw error('"validated" must be boolean, not: ' + options.validated);
              }
            Severity: Minor
            Found in api/lib/validate.js and 1 other location - About 40 mins to fix
            api/lib/validate.js on lines 538..540

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              if (options.submit !== undefined && !_.isBoolean(options.submit)) {
                throw error('"submit" must be boolean, not: ' + options.submit);
              }
            Severity: Minor
            Found in api/lib/validate.js and 1 other location - About 40 mins to fix
            api/lib/validate.js on lines 535..537

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

            function getTransaction(api, account, identifier, requestOptions, callback) {
            Severity: Minor
            Found in api/transactions.js - About 35 mins to fix

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

              function getOrderBook(account, base, counter, options, callback) {
              Severity: Minor
              Found in api/orders.js - About 35 mins to fix

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

                function submitTransaction(api, tx, secret, options, callback) {
                Severity: Minor
                Found in api/transactions.js - About 35 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language