File transactions.js
has 411 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable valid-jsdoc */
'use strict';
var _ = require('lodash');
var assert = require('assert');
Function getTransaction
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getTransaction(api, account, identifier, requestOptions, callback) {
try {
assert.strictEqual(typeof requestOptions, 'object');
Function transactionFilter
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
function transactionFilter(transactions, options) {
var filtered_transactions = transactions.filter(function(transaction) {
if (options.exclude_failed) {
if (transaction.state === 'failed' || (transaction.meta
&& transaction.meta.TransactionResult !== 'tesSUCCESS')) {
- Read upRead up
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 98 lines of code (exceeds 25 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,
Function getTransaction
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
function getTransaction(api, account, identifier, requestOptions, callback) {
try {
assert.strictEqual(typeof requestOptions, 'object');
- Read upRead up
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 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);
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);
- Read upRead up
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 transactionFilter
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function transactionFilter(transactions, options) {
var filtered_transactions = transactions.filter(function(transaction) {
if (options.exclude_failed) {
if (transaction.state === 'failed' || (transaction.meta
&& transaction.meta.TransactionResult !== 'tesSUCCESS')) {
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;
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) {
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,
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);
}
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,
- Read upRead up
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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function submitTransaction(api, tx, secret, options, callback) {
Function getTransaction
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function getTransaction(api, account, identifier, requestOptions, callback) {
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return callback(new errors.NotFoundError('Ledger not found'));
Avoid too many return
statements within this function. Open
return false;