Showing 105 of 151 total issues
Function createPaymentTransaction
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createPaymentTransaction(account, payment) {
validate.address(account);
validate.payment(payment);
// Convert blank issuer to sender's address
Function getOrders
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getOrders(account, options, callback) {
var self = this;
validate.address(account);
validate.options(options);
File tx-to-rest-converter.js
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable valid-jsdoc */
'use strict';
var ripple = require('ripple-lib');
var utils = require('./utils');
var _ = require('lodash');
Function saveTransaction
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
DI.saveTransaction = function(transaction, callback) {
assert.strictEqual(typeof transaction, 'object');
assert(transaction.state, 'Transaction missing property: state');
assert(transaction.tx_json, 'Transaction missing property: tx_json');
assert(transaction.tx_json.TransactionType,
Function parse
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
NotificationParser.prototype.parse = function(notification_details, urlBase) {
var transaction = notification_details.transaction;
var account = notification_details.account;
var previous_transaction_identifier =
notification_details.previous_transaction_identifier;
Function validateSettings
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function validateSettings(settings) {
if (typeof settings !== 'object') {
throw error('Invalid parameter: settings');
}
if (!/(undefined|string)/.test(typeof settings.domain)) {
- 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 getTrustLines
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function getTrustLines(account, options, callback) {
validate.address(account);
validate.currency(options.currency, true);
validate.counterparty(options.counterparty, true);
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 parseOrderFromTx
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function parseOrderFromTx(tx, options) {
if (!options.account) {
throw new Error('Internal Error. must supply options.account');
}
if (tx.TransactionType !== 'OfferCreate'
- 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 getNotifications
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getNotifications(account, urlBase, options, callback) {
validate.address(account);
var self = this;
File routes.js
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
var _ = require('lodash');
var api = require('./api');
var respond = require('./response-handler');
var config = require('./config');
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 parseOrderFromTx
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseOrderFromTx(tx, options) {
if (!options.account) {
throw new Error('Internal Error. must supply options.account');
}
if (tx.TransactionType !== 'OfferCreate'
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 getNotificationHelper
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getNotificationHelper(api, account, identifier, urlBase, topCallback) {
function getTransaction(callback) {
try {
transactions.getTransaction(api, account, identifier, {}, callback);
Function parse
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
NotificationParser.prototype.parse = function(notification_details, urlBase) {
var transaction = notification_details.transaction;
var account = notification_details.account;
var previous_transaction_identifier =
notification_details.previous_transaction_identifier;
- 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 setTransactionFields
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function setTransactionFields(transaction, input, fieldSchema) {
for (var fieldName in fieldSchema) {
var field = fieldSchema[fieldName];
var value = input[field.name];
- 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 getAccountLines
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getAccountLines(prevResult) {
var isAggregate = options.limit === 'all';
if (prevResult && (!isAggregate || !prevResult.marker)) {
return Promise.resolve(prevResult);
}
Function attachPreviousAndNextTransactionIdentifiers
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function attachPreviousAndNextTransactionIdentifiers(api,
notificationDetails, topCallback) {
// Get all of the transactions affecting the specified
// account in the given ledger. This is done so that
- 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 parsePaymentFromTx
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function parsePaymentFromTx(account, message, meta) {
if (!account) {
throw new Error('Internal Error. must supply options.account');
}
- 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 validateSettings
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function validateSettings(settings) {
if (typeof settings !== 'object') {
throw error('Invalid parameter: settings');
}
if (!/(undefined|string)/.test(typeof settings.domain)) {