ripple/ripple-rest

View on GitHub

Showing 151 of 151 total issues

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

function changeSettings(account, settings, secret, options, callback) {
Severity: Minor
Found in api/settings.js - About 35 mins to fix

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

    function addTrustLine(account, trustline, secret, options, callback) {
    Severity: Minor
    Found in api/trustlines.js - About 35 mins to fix

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

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

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

        function getPathFind(source_account, destination_account,
            destination_amount_string, source_currency_strings, callback) {
        Severity: Minor
        Found in api/payments.js - About 35 mins to fix

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

          function getNotificationHelper(api, account, identifier, urlBase, topCallback) {
          Severity: Minor
          Found in api/notifications.js - About 35 mins to fix

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

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

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

                var options = {
                  ledger: request.query.ledger,
                  limit: request.query.limit,
                  marker: request.query.marker
                };
              Severity: Minor
              Found in server/routes.js and 1 other location - About 35 mins to fix
              server/routes.js on lines 127..131

              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 47.

              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

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

                var options = {
                  ledger: request.query.ledger,
                  limit: request.query.limit,
                  marker: request.query.marker
                };
              Severity: Minor
              Found in server/routes.js and 1 other location - About 35 mins to fix
              server/routes.js on lines 139..143

              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 47.

              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 validateOrder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              function validateOrder(order) {
                if (!order) {
                  throw error('Missing parameter: order. '
                    + 'Submission must have order object in JSON form');
                } else if (!/^buy|sell$/.test(order.type)) {
              Severity: Minor
              Found in api/lib/validate.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

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

                if (orderbook.base && orderbook.base.currency === 'XRP'
                    && orderbook.base.counterparty) {
                  throw error('Invalid parameter: base. XRP cannot have counterparty');
                }
              Severity: Minor
              Found in api/lib/validate.js and 1 other location - About 35 mins to fix
              api/lib/validate.js on lines 178..181

              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 46.

              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 (orderbook.counter && orderbook.counter.currency === 'XRP'
                    && orderbook.counter.counterparty) {
                  throw error('Invalid parameter: counter. XRP cannot have counterparty');
                }
              Severity: Minor
              Found in api/lib/validate.js and 1 other location - About 35 mins to fix
              api/lib/validate.js on lines 182..185

              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 46.

              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

              Avoid too many return statements within this function.
              Open

                      return callback(new errors.NotFoundError('Ledger not found'));
              Severity: Major
              Found in api/transactions.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return true;
                Severity: Major
                Found in api/transactions.js - About 30 mins to fix

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

                  function internalError(response, message, body) {
                    var content = errorContent(ErrorType.server, message, body);
                    send(response, content, StatusCode.internalServerError);
                  }
                  Severity: Major
                  Found in server/response-handler.js and 3 other locations - About 30 mins to fix
                  server/response-handler.js on lines 115..118
                  server/response-handler.js on lines 127..130
                  server/response-handler.js on lines 176..179

                  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 45.

                  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.earliest_first) {
                          args.previous_hash = previous ? previous.hash : undefined;
                          args.next_hash = next ? next.hash : undefined;
                        } else {
                  Severity: Minor
                  Found in api/notifications.js and 1 other location - About 30 mins to fix
                  api/notifications.js on lines 327..330

                  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 45.

                  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

                  Avoid too many return statements within this function.
                  Open

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

                    Avoid too many return statements within this function.
                    Open

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

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

                        if (!/(undefined|number)/.test(typeof settings.wallet_size)) {
                          if (settings.wallet_size !== '') {
                            throw error('Parameter must be a number: wallet_size');
                          }
                        }
                      Severity: Minor
                      Found in api/lib/validate.js and 1 other location - About 30 mins to fix
                      api/lib/validate.js on lines 383..387

                      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 45.

                      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

                        var takerPays = order.taker_pays.currency !== 'XRP'
                          ? order.taker_pays : utils.xrpToDrops(order.taker_pays.value);
                      Severity: Minor
                      Found in api/transaction/order.js and 1 other location - About 30 mins to fix
                      api/transaction/order.js on lines 23..24

                      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 45.

                      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 4 locations. Consider refactoring.
                      Open

                      function transactionNotFoundError(response, message, body) {
                        var content = errorContent(ErrorType.transaction, message, body);
                        send(response, content, StatusCode.notFound);
                      }
                      Severity: Major
                      Found in server/response-handler.js and 3 other locations - About 30 mins to fix
                      server/response-handler.js on lines 115..118
                      server/response-handler.js on lines 164..167
                      server/response-handler.js on lines 176..179

                      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 45.

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language