Showing 57 of 111 total issues
File curr.d.ts
has 8742 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Automatically generated on 2023-10-16T10:48:00-08:00
import { Operation } from './index';
export {};
File next.d.ts
has 8742 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Automatically generated on 2023-10-16T10:48:00-08:00
import { Operation } from './index';
export {};
File index.d.ts
has 1163 lines of code (exceeds 250 allowed). Consider refactoring. Open
// TypeScript Version: 2.9
/// <reference types="node" />
import { xdr } from './xdr';
Function fromXDRObject
has 257 lines of code (exceeds 25 allowed). Consider refactoring. Open
static fromXDRObject(operation) {
const result = {};
if (operation.sourceAccount()) {
result.source = encodeMuxedAccountToAddress(operation.sourceAccount());
}
File operation.js
has 499 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable no-bitwise */
import { Hyper } from '@stellar/js-xdr';
import BigNumber from './util/bignumber';
import { trimEnd } from './util/util';
Function setOptions
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
export function setOptions(opts) {
const attributes = {};
if (opts.inflationDest) {
if (!StrKey.isValidEd25519PublicKey(opts.inflationDest)) {
- 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 nativeToScVal
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
export function nativeToScVal(val, opts = {}) {
switch (typeof val) {
case 'object': {
if (val === null) {
return xdr.ScVal.scvVoid();
- 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 setOptions
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function setOptions(opts) {
const attributes = {};
if (opts.inflationDest) {
if (!StrKey.isValidEd25519PublicKey(opts.inflationDest)) {
Function nativeToScVal
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function nativeToScVal(val, opts = {}) {
switch (typeof val) {
case 'object': {
if (val === null) {
return xdr.ScVal.scvVoid();
File test.ts
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as StellarSdk from 'stellar-base';
const masterKey = StellarSdk.Keypair.master(StellarSdk.Networks.TESTNET); // $ExpectType Keypair
const sourceKey = StellarSdk.Keypair.random(); // $ExpectType Keypair
const destKey = StellarSdk.Keypair.random();
Function fromXDRObject
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
static fromXDRObject(operation) {
const result = {};
if (operation.sourceAccount()) {
result.source = encodeMuxedAccountToAddress(operation.sourceAccount());
}
- 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 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(envelope, networkPassphrase) {
if (typeof envelope === 'string') {
const buffer = Buffer.from(envelope, 'base64');
envelope = xdr.TransactionEnvelope.fromXDR(buffer);
}
Function extractRevokeSponshipDetails
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
function extractRevokeSponshipDetails(attrs, result) {
switch (attrs.switch().name) {
case 'revokeSponsorshipLedgerEntry': {
const ledgerKey = attrs.ledgerKey();
switch (ledgerKey.switch().name) {
Transaction
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
export class Transaction extends TransactionBase {
constructor(envelope, networkPassphrase) {
if (typeof envelope === 'string') {
const buffer = Buffer.from(envelope, 'base64');
envelope = xdr.TransactionEnvelope.fromXDR(buffer);
Function revokeSignerSponsorship
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export function revokeSignerSponsorship(opts = {}) {
if (!StrKey.isValidEd25519PublicKey(opts.account)) {
throw new Error('account is invalid');
}
let key;
- 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 scValToNative
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function scValToNative(scv) {
// we use the verbose xdr.ScValType.<type>.value form here because it's faster
// than string comparisons and the underlying constants never need to be
// updated
switch (scv.switch().value) {
Function buildInvocationTree
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function buildInvocationTree(root) {
const fn = root.function();
/** @type {InvocationTree} */
const output = {};
Function isValid
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function isValid(versionByteName, encoded) {
if (typeof encoded !== 'string') {
return false;
}
Function authorizeEntry
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function authorizeEntry(
entry,
signer,
validUntilLedgerSeq,
networkPassphrase = Networks.FUTURENET
Function revokeSignerSponsorship
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function revokeSignerSponsorship(opts = {}) {
if (!StrKey.isValidEd25519PublicKey(opts.account)) {
throw new Error('account is invalid');
}
let key;