Showing 20 of 49 total issues
Function validate
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public validate(
boundWitness: XyoBoundWitness,
allowUnknownSignatures: boolean
): boolean {
const signingData = boundWitness.getSigningData()
- 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 waitForMessage
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private waitForMessage(): Promise<Buffer> {
return new Promise((resolve, reject) => {
let hasResumed = false
let waitSize: number
let currentSize = 0
Function connectionListener
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private connectionListener(socket: net.Socket) {
this.logInfo(
`New connection made with ${socket.remoteAddress}:${socket.remotePort}`
)
Function getOriginInformationFromFetter
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private static getOriginInformationFromFetter(
fetterHeuristics: XyoStructure[]
): IXyoBoundWitnessOrigin {
let nextPublicKey: Buffer | undefined
let previousHash: Buffer | 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 boundWitness
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async boundWitness(
handler: XyoNetworkHandler,
catalogue: XyoProcedureCatalog,
signers: XyoSigner[]
): Promise<XyoBoundWitness | undefined> {
Function validate
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public validate(
boundWitness: XyoBoundWitness,
allowUnknownSignatures: boolean
): boolean {
const signingData = boundWitness.getSigningData()
Function createBlockfromJson
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public createBlockfromJson(boundWitness: {
[key: string]: any
}): XyoZigZagBoundWitness | undefined {
const allKeys = Object.keys(boundWitness)
if (allKeys.length > 2 || allKeys.length === 0) {
Function insert
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async insert(boundWitness: XyoBoundWitness) {
const bridgeBlocks = this.getNestedObjectType(
boundWitness,
XyoObjectSchema.WITNESS,
XyoObjectSchema.BRIDGE_BLOCK_SET
Function removeBridgeBlocks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private removeBridgeBlocks(
boundWitness: XyoBoundWitness
): XyoIterableStructure {
const newLedgerItems: XyoStructure[] = []
const it = boundWitness.newIterator()
- 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 getNestedObjectType
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private getNestedObjectType(
boundWitness: XyoBoundWitness,
rootSchema: XyoSchema,
subSchema: XyoSchema
): XyoStructure | 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 removeBridgeBlocks
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private removeBridgeBlocks(
boundWitness: XyoBoundWitness
): XyoIterableStructure {
const newLedgerItems: XyoStructure[] = []
const it = boundWitness.newIterator()
Function getOriginInformationFromFetter
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static getOriginInformationFromFetter(
fetterHeuristics: XyoStructure[]
): IXyoBoundWitnessOrigin {
let nextPublicKey: Buffer | undefined
let previousHash: Buffer | undefined
Function encode
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static encode(schema: XyoSchema, value: XyoBuffer): XyoBuffer {
const bestSize = XyoSizeUtil.getBestSize(value.getSize())
const header = Buffer.alloc(2 + bestSize.valueOf())
const size = value.getSize() + bestSize.valueOf()
const optimizedSchema = XyoSchema.create(
Function getCurrentFileState
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private getCurrentFileState(): IXyoFileOriginState {
const signersString: string[] = []
let previousHashString: string | undefined
let indexString: string | undefined
Function validate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static validate(structure: XyoIterableStructure) {
const it = structure.newIterator()
try {
while (it.hasNext()) {
- 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 true
Function sendAndReceive
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private async sendAndReceive(
didHaveData: boolean,
transfer: XyoIterableStructure | undefined
) {
let response: Buffer | 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 doBoundWitness
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public async doBoundWitness(
transfer: XyoIterableStructure | undefined
): Promise<void> {
if (!this.getIsCompleted()) {
const response = await this.sendAndReceive(
- 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 getSignatures
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public getSignatures(): XyoStructure[][] {
const signatureSets: XyoStructure[][] = []
const witnesses = this.getId(
XyoObjectSchema.WITNESS.id
) as XyoIterableStructure[]
- 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 getPublicKeys
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public getPublicKeys(): XyoStructure[][] {
const keysets: XyoStructure[][] = []
const fetters = this.getId(
XyoObjectSchema.FETTER.id
) as XyoIterableStructure[]
- 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"