Showing 105 of 151 total issues
File orders.js
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* globals Promise: true */
/* eslint-disable valid-jsdoc */
'use strict';
var _ = require('lodash');
var asyncify = require('simple-asyncify');
Function getLineBalances
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getLineBalances(prevResult) {
var isAggregate = options.limit === 'all';
if (prevResult && (!isAggregate || !prevResult.marker)) {
return Promise.resolve(prevResult);
}
Function promise
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
var promise = new Promise(function(resolve, reject) {
var accountLinesRequest;
var marker;
var ledger;
var limit;
Function getOrders
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function getOrders(account, options, callback) {
var self = this;
validate.address(account);
validate.options(options);
- 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 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) {
Function createRemote
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createRemote(options) {
var remote = new ripple.Remote(options);
if (options.mock) {
return remote;
}
Function promise
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
var promise = new Promise(function(resolve, reject) {
var accountLinesRequest;
var marker;
var ledger;
var limit;
Function parsePaymentFromTx
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parsePaymentFromTx(account, message, meta) {
if (!account) {
throw new Error('Internal Error. must supply options.account');
}
Function getParsedBookOffers
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getParsedBookOffers(offers, isAsk) {
return offers.reduce(function(orderBook, off) {
var price;
var order_maker = off.Account;
var sequence = off.Sequence;
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') {
Function validateOptions
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function validateOptions(options) {
if (options.max_fee !== undefined) {
validateNonNegativeStringFloat(options.max_fee, 'max_fee');
}
if (options.fixed_fee !== undefined) {
Function parsePaymentsFromPathFind
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parsePaymentsFromPathFind(pathfindResults) {
return pathfindResults.alternatives.map(function(alternative) {
return {
source_account: pathfindResults.source_account,
source_tag: '',
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 createTxJSON
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function createTxJSON(transaction, remote, instructions, callback) {
instructions = instructions || {};
validate.options(instructions);
transaction.complete();
- 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 setTransactionBitFlags
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function setTransactionBitFlags(transaction, options) {
for (var flagName in options.flags) {
var flag = options.flags[flagName];
// Set transaction flags
- 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 getTransaction
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
DI.getTransaction = function(options, callback) {
assert.strictEqual(typeof options, 'object');
var txQuery = {};
Function generateIndexPage
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateIndexPage(request, response, next) {
var url_base = '/v' + version.getApiVersion();
respond.success(response, {
success: true,
Function parseNotifications
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseNotifications(baseTransactions, _callback) {
var numTransactions = baseTransactions.length;
function parseNotification(transaction, __callback) {
var args = {
Function getAccountOrders
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getAccountOrders(prevResult) {
var isAggregate = options.limit === 'all';
if (prevResult && (!isAggregate || !prevResult.marker)) {
return Promise.resolve(prevResult);
}
Function init
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
DI.init = function(callback) {
var self = this;
if (this.initialized) {
self.logger.info('[DB] Warning: Re-initializing');