Showing 57 of 111 total issues
Function _validateHashValue
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
static _validateHashValue(value) {
const error = new Error(
`Expects a 32 byte hash value or hex encoded string. Got ${value}`
);
- 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 compare
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static compare(assetA, assetB) {
if (!assetA || !(assetA instanceof Asset)) {
throw new Error('assetA is invalid');
}
if (!assetB || !(assetB instanceof Asset)) {
- 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 changeTrust
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function changeTrust(opts) {
const attributes = {};
if (opts.asset instanceof Asset) {
attributes.line = opts.asset.toChangeTrustXDRObject();
- 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 constructor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
constructor(value, opts) {
const signed = value < 0;
let type = opts?.type ?? '';
if (type.startsWith('u') && signed) {
throw TypeError(`specified type ${opts.type} yet negative (${value})`);
- 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 authorizeInvocation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
signer,
validUntilLedgerSeq,
invocation,
publicKey = '',
networkPassphrase = Networks.FUTURENET
Function getLiquidityPoolId
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function getLiquidityPoolId(
liquidityPoolType,
liquidityPoolParameters = {}
) {
if (liquidityPoolType !== 'constant_product') {
- 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 constructor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
constructor(code, issuer) {
if (!/^[a-zA-Z0-9]{1,12}$/.test(code)) {
throw new Error(
'Asset code is invalid (maximum alphanumeric, 12 characters at max)'
);
- 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 manageData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function manageData(opts) {
const attributes = {};
if (!(typeof opts.name === 'string' && opts.name.length <= 64)) {
throw new Error('name must be a string, up to 64 characters');
- 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
Avoid too many return
statements within this function. Open
return xdr.ScVal.scvMap(
Object.entries(val).map(([k, v]) => {
// the type can be specified with an entry for the key and the value,
// e.g. val = { 'hello': 1 } and opts.type = { hello: [ 'symbol',
// 'u128' ]} or you can use `null` for the default interpretation
Avoid too many return
statements within this function. Open
return new ScInt(val, { type: opts?.type }).toScVal();
Avoid too many return
statements within this function. Open
return xdr.ScVal.scvVec(val.map((v) => nativeToScVal(v, opts)));
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return new XdrLargeInt(optType, val).toScVal();
Function addSignature
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
addSignature(publicKey = '', signature = '') {
if (!signature || typeof signature !== 'string') {
throw new Error('Invalid signature');
}
- 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 buildInvocationTree
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function buildInvocationTree(root) {
const fn = root.function();
/** @type {InvocationTree} */
const output = {};
- 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 constructor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
constructor(assetA, assetB, fee) {
if (!assetA || !(assetA instanceof Asset)) {
throw new Error('assetA is invalid');
}
if (!assetB || !(assetB instanceof Asset)) {
- 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 extractRevokeSponshipDetails
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function extractRevokeSponshipDetails(attrs, result) {
switch (attrs.switch().name) {
case 'revokeSponsorshipLedgerEntry': {
const ledgerKey = attrs.ledgerKey();
switch (ledgerKey.switch().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"