ripple/ripple-rest

View on GitHub
api/payments.js

Summary

Maintainability
D
2 days
Test Coverage

Function getPathFind has 137 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getPathFind(source_account, destination_account,
    destination_amount_string, source_currency_strings, callback) {
  var self = this;

  var destination_amount = renameCounterpartyToIssuer(
Severity: Major
Found in api/payments.js - About 5 hrs to fix

    Function getPathFind has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    function getPathFind(source_account, destination_account,
        destination_amount_string, source_currency_strings, callback) {
      var self = this;
    
      var destination_amount = renameCounterpartyToIssuer(
    Severity: Minor
    Found in api/payments.js - About 4 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

    File payments.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint-disable valid-jsdoc */
    'use strict';
    
    var _ = require('lodash');
    var async = require('async');
    Severity: Minor
    Found in api/payments.js - About 3 hrs to fix

      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 submitPayment has 39 lines of code (exceeds 25 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 1 hr to fix

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

                There are no issues that match your filters.

                Category
                Status