Showing 105 of 151 total issues
Function getFailedTransactions
has 33 lines of code (exceeds 25 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');
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 createTxJSON
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createTxJSON(transaction, remote, instructions, callback) {
instructions = instructions || {};
validate.options(instructions);
transaction.complete();
Function validateOptions
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function validateOptions(options) {
if (options.max_fee !== undefined) {
validateNonNegativeStringFloat(options.max_fee, 'max_fee');
}
if (options.fixed_fee !== undefined) {
- 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 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 parseNotification
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseNotification(transaction, __callback) {
var args = {
account: account,
identifier: transaction.hash,
transaction: transaction
Function validateTrustline
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function validateTrustline(trustline) {
if (typeof trustline !== 'object') {
throw error('Invalid parameter: trustline');
}
if (_.isUndefined(trustline.limit)) {
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 exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (function() {
var validator = new JaySchema();
var validate = validator.validate;
// If schema is valid, return true. Otherwise
Function validateTrustline
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function validateTrustline(trustline) {
if (typeof trustline !== 'object') {
throw error('Invalid parameter: trustline');
}
if (_.isUndefined(trustline.limit)) {
- 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 promise
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
var promise = new Promise(function(resolve, reject) {
var accountOrdersRequest;
var marker;
var ledger;
var limit;
Function findPreviousAndNextTransactions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function findPreviousAndNextTransactions(txns, callback) {
// Find the index in the array of the baseTransaction
var baseTransactionIndex = _.findIndex(txns, function(possibility) {
if (possibility.hash === notificationDetails.transaction.hash) {
Function validatePaymentMemos
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function validatePaymentMemos(memos) {
if (!Array.isArray(memos)) {
throw error(
'Invalid parameter: memos. Must be an array with memo objects');
}
- 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 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 parseCurrencyQuery
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function parseCurrencyQuery(query) {
var params = query.split('+');
if (!isNaN(params[0])) {
return {
- 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 submitPayment
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function submitPayment(account, payment, clientResourceID, secret,
urlBase, options, callback) {
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');
- 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 prepareAndOptionallySign
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function prepareAndOptionallySign(transaction, api, secret, options,
converter, callback) {
Function transact
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function transact(transaction, api, secret, options, converter, callback) {